HP IMC custom scripting - Lindsay Hill · • Manually run the sequence of backup commands first, ... • Check /server/tmp/ for temporary session files created during
Post on 14-Jul-2020
4 Views
Preview:
Transcript
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
HP IMC custom scripting Extending IMC for fun and profit
Lindsay Hill Aaron Paxson June 12 2013
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 3
Agenda
bull Introductions
bull Developing device adapters
bull Adding custom functions to IMC
bull eAPI walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 4
Introductions
Lindsay Hill northlandboy - httplkhillcom
Primoris New Zealand (HP Partner)
bull Network Management Consultant
bull Install Configure and Support HP IMC for medium-sized Enterprises
bull CCIE CISSP RHCE
Aaron Paxson Neelixx - httpmyteneonet
SVP Worldwide
bull Global Network Manager
bull HP IMC Customer
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 5
wwwnetopscommunitynet
Independent community forum dedicated to helping fellow engineers with installing using and extending IMC
GitHub repository of 3rd-party developed custom scripts and adapters ndash free to use
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Building device adapters
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 7
Device adapters - overview
bull IMC supports over 6000 devices through the use of device adapters
bull IMC has standardized functions and variables for configuration management ndash these cover config backup config deployment and image deployment
bull Adapters define how these functions are turned into device-specific commands using XML TCL and Perl
bull Fully supported system for writing your own adapters to support new devicesor add custom functions to solve your business problems
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 8
Device adapter directories
Each vendor has its own directory with subdirectories for specific adapters
ltIMCgtserverconfadaptersICC
Cisco
CiscoASA
CiscoCatNative
CiscoIOSGeneric
CiscoNX7K
CiscoSNMP
Hewlett Packard
HPGbE2C
HPProLiant
HPProcurve
HPProcurveMSM
HPProcurve3500
ltVendorgtadapter-indexxml - assigns sysOIDS to adapters
ltVendorgtltAdaptergtadapterxml describes services and points to other XML files used
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 9
Device adapters ndash files
XML files define capabilities while TCLExpect files are used for running commands
tcl
bull Carries out functions using ExpectTCL
bull Parameters passed in
bull CLI output parsed by Perl script
_Builder _Scriptxml
bull Maps commands to individual TCL files
bull Defines script prerequisites and mode ndash eg CLI TFTP
_Builderxml
bull Action definition
bull Defines required actions order steps ndash maps to commands
Adapterxml
bull Service definition for services offered by that adapter ndash common functions backup deployment
bull Points to specific XML files
adapter-indexxml
bull Maps sysOIDs to specific adapters
bull Can define default adapter
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 10
Sample content from F5 adapter
Device adapters ndash examples
F5adapter-indexxml ltxml version=10gt
lt--sysoid adapt adapter--gt
ltadaptersgt
lttype name=CLIrdquogt
ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltsysoidgt1361413375213443ltsysoidgt
ltversion series=F5BIG vrp= release=gt
ltdefaultver series=F5BIG vrp= release=gt
ltadaptergt
lttypegt
ltadaptersgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 11
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPadapterxml ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltversiongt100ltversiongt
ltservicesgt
ltservice name=CLICommongt
ltitem type=commongtF5_Common_CLIxmlltitemgt
ltservicegt
ltservice name=ConfigBackupgt
ltitem type=builder_definitiongtF5_Config_Backup_Builderxmlltitemgt
ltitem type=tcl_scriptgtF5_Config_Backup_Builder_Scriptxmlltitemgt
ltservicegt
ltservicesgt
ltadaptergt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 12
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPF5_Config_Backup_Builder_Scriptxml ltxml version=10gt
ltscriptsgt
ltcommand name=backup_running_config_ftp method=FTPgt
lterrorgtFailed to upload configuration to FTP server FTP server may be down or incorrectly specified command syntax may be incorrect or prompts may not be what was expectedlterrorgt
ltrequire-modegtexecltrequire-modegt
ltscriptgt
backup_running_config_ftptcl
ltscriptgt
ltcommandgt
ltscriptsgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 13
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPbackup_running_config_ftptcl
Identificationbackup_running_config_ftp
Purpose backup running config via ftp
set timeout $very_long_timeout
set sourceFile varlocalucsimc_icc_f5_cfgucs
ftp_trans_file true $sourceFile $TFTPFile
set timeout $standard_timeout
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 14
Quick recap IMC backup methods
File transfer methods
bull SNMP Read-Write and TFTPFTP
bull Telnet and TFTPFTP
bull SCPSFTP
bull CLI (TelnetSSH) + ldquoshow runrdquo (or equivalent)
Backup method selection
bull IMC tries SNMP first if adapter defined
bull Then tries file transfer method defined in configuration center -gt options
bull If that fails falls back to CLI
bull Canrsquot mix SNMP and SCPSFTP
Key is understanding methods and data flow direction
IMC Device SCP SFTP
FTP TFTP
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 15
Summary of steps involved
Build your own device adapter
bull Analyze your device
ndash What access methods does it support
ndash What commands do we need to run to take a backup Is this similar to any other device already supported by IMC
ndash Does it have both a startup and a running configuration
bull Configure IMC
ndash Add device model series and vendor to IMC Note sysOID
ndash Create new folder ltIMCgtserverconfadaptersICCltVendorgt
ndash Create new adapter folder ltIMCgtserverconfadaptersICCltVendorgtltAdapter_Namegt
bull Create adapter files ndash service definitions and TCL files
bull Restart IMC to pick up new adapter
bull Discover device (or synchronize if already in IMC)
bull Test
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 16
Live walkthrough
Live walk through of process of adding new device adapter for Fortinet system
Will cover process of adding new device creating adapter files and running a backup
Shows logfiles to look at for troubleshooting
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 17
Troubleshooting process
bull Check your credentials login type and file transfer mode
bull Know what backup method you expect to be used (SCP SFTP CLI TFTP FTP)
bull Manually run the sequence of backup commands first from the IMC server
bull Key log file is ltIMCgtserverconflogimccfgbakdmlog ndash tells you almost everything you need to know ndash but it takes some decoding
bull First check that the right adapter is being selected ndash look for lines like
ndash Device login type is 1dev_id=4AdaptName=CiscoASA
bull Follow log file ndash see which TCL files are being executed and what the results are
bull Check ltIMCgtservertmp for temporary session files created during execution ndash these show all the output created These are deleted on normal exit
bull Use Wireshark to inspect traffic if required
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 18
Lessons from the field
bull Copy and tweak an existing adapter if you can
bull Use unencrypted communications during development if possible ndash Wireshark can really help
bull Set timeouts to low values during debugging ndash ldquoset timeout 10rdquo
bull Keep it simple ndash start with just backups using just one method Add more later
bull Key locations
ndash Log file ltIMCgtserverconflogimccfgbakdmlog
ndash Temporary files ltIMCgtservertmp
ndash Backups ltIMCgtserverdatacfgbak
bull Pay close attention to timestamps in imccfgbakdm log file ndash these may appear out of order
bull Restart IMC and synchronize devices when first adding new adapters
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 3
Agenda
bull Introductions
bull Developing device adapters
bull Adding custom functions to IMC
bull eAPI walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 4
Introductions
Lindsay Hill northlandboy - httplkhillcom
Primoris New Zealand (HP Partner)
bull Network Management Consultant
bull Install Configure and Support HP IMC for medium-sized Enterprises
bull CCIE CISSP RHCE
Aaron Paxson Neelixx - httpmyteneonet
SVP Worldwide
bull Global Network Manager
bull HP IMC Customer
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 5
wwwnetopscommunitynet
Independent community forum dedicated to helping fellow engineers with installing using and extending IMC
GitHub repository of 3rd-party developed custom scripts and adapters ndash free to use
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Building device adapters
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 7
Device adapters - overview
bull IMC supports over 6000 devices through the use of device adapters
bull IMC has standardized functions and variables for configuration management ndash these cover config backup config deployment and image deployment
bull Adapters define how these functions are turned into device-specific commands using XML TCL and Perl
bull Fully supported system for writing your own adapters to support new devicesor add custom functions to solve your business problems
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 8
Device adapter directories
Each vendor has its own directory with subdirectories for specific adapters
ltIMCgtserverconfadaptersICC
Cisco
CiscoASA
CiscoCatNative
CiscoIOSGeneric
CiscoNX7K
CiscoSNMP
Hewlett Packard
HPGbE2C
HPProLiant
HPProcurve
HPProcurveMSM
HPProcurve3500
ltVendorgtadapter-indexxml - assigns sysOIDS to adapters
ltVendorgtltAdaptergtadapterxml describes services and points to other XML files used
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 9
Device adapters ndash files
XML files define capabilities while TCLExpect files are used for running commands
tcl
bull Carries out functions using ExpectTCL
bull Parameters passed in
bull CLI output parsed by Perl script
_Builder _Scriptxml
bull Maps commands to individual TCL files
bull Defines script prerequisites and mode ndash eg CLI TFTP
_Builderxml
bull Action definition
bull Defines required actions order steps ndash maps to commands
Adapterxml
bull Service definition for services offered by that adapter ndash common functions backup deployment
bull Points to specific XML files
adapter-indexxml
bull Maps sysOIDs to specific adapters
bull Can define default adapter
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 10
Sample content from F5 adapter
Device adapters ndash examples
F5adapter-indexxml ltxml version=10gt
lt--sysoid adapt adapter--gt
ltadaptersgt
lttype name=CLIrdquogt
ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltsysoidgt1361413375213443ltsysoidgt
ltversion series=F5BIG vrp= release=gt
ltdefaultver series=F5BIG vrp= release=gt
ltadaptergt
lttypegt
ltadaptersgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 11
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPadapterxml ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltversiongt100ltversiongt
ltservicesgt
ltservice name=CLICommongt
ltitem type=commongtF5_Common_CLIxmlltitemgt
ltservicegt
ltservice name=ConfigBackupgt
ltitem type=builder_definitiongtF5_Config_Backup_Builderxmlltitemgt
ltitem type=tcl_scriptgtF5_Config_Backup_Builder_Scriptxmlltitemgt
ltservicegt
ltservicesgt
ltadaptergt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 12
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPF5_Config_Backup_Builder_Scriptxml ltxml version=10gt
ltscriptsgt
ltcommand name=backup_running_config_ftp method=FTPgt
lterrorgtFailed to upload configuration to FTP server FTP server may be down or incorrectly specified command syntax may be incorrect or prompts may not be what was expectedlterrorgt
ltrequire-modegtexecltrequire-modegt
ltscriptgt
backup_running_config_ftptcl
ltscriptgt
ltcommandgt
ltscriptsgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 13
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPbackup_running_config_ftptcl
Identificationbackup_running_config_ftp
Purpose backup running config via ftp
set timeout $very_long_timeout
set sourceFile varlocalucsimc_icc_f5_cfgucs
ftp_trans_file true $sourceFile $TFTPFile
set timeout $standard_timeout
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 14
Quick recap IMC backup methods
File transfer methods
bull SNMP Read-Write and TFTPFTP
bull Telnet and TFTPFTP
bull SCPSFTP
bull CLI (TelnetSSH) + ldquoshow runrdquo (or equivalent)
Backup method selection
bull IMC tries SNMP first if adapter defined
bull Then tries file transfer method defined in configuration center -gt options
bull If that fails falls back to CLI
bull Canrsquot mix SNMP and SCPSFTP
Key is understanding methods and data flow direction
IMC Device SCP SFTP
FTP TFTP
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 15
Summary of steps involved
Build your own device adapter
bull Analyze your device
ndash What access methods does it support
ndash What commands do we need to run to take a backup Is this similar to any other device already supported by IMC
ndash Does it have both a startup and a running configuration
bull Configure IMC
ndash Add device model series and vendor to IMC Note sysOID
ndash Create new folder ltIMCgtserverconfadaptersICCltVendorgt
ndash Create new adapter folder ltIMCgtserverconfadaptersICCltVendorgtltAdapter_Namegt
bull Create adapter files ndash service definitions and TCL files
bull Restart IMC to pick up new adapter
bull Discover device (or synchronize if already in IMC)
bull Test
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 16
Live walkthrough
Live walk through of process of adding new device adapter for Fortinet system
Will cover process of adding new device creating adapter files and running a backup
Shows logfiles to look at for troubleshooting
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 17
Troubleshooting process
bull Check your credentials login type and file transfer mode
bull Know what backup method you expect to be used (SCP SFTP CLI TFTP FTP)
bull Manually run the sequence of backup commands first from the IMC server
bull Key log file is ltIMCgtserverconflogimccfgbakdmlog ndash tells you almost everything you need to know ndash but it takes some decoding
bull First check that the right adapter is being selected ndash look for lines like
ndash Device login type is 1dev_id=4AdaptName=CiscoASA
bull Follow log file ndash see which TCL files are being executed and what the results are
bull Check ltIMCgtservertmp for temporary session files created during execution ndash these show all the output created These are deleted on normal exit
bull Use Wireshark to inspect traffic if required
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 18
Lessons from the field
bull Copy and tweak an existing adapter if you can
bull Use unencrypted communications during development if possible ndash Wireshark can really help
bull Set timeouts to low values during debugging ndash ldquoset timeout 10rdquo
bull Keep it simple ndash start with just backups using just one method Add more later
bull Key locations
ndash Log file ltIMCgtserverconflogimccfgbakdmlog
ndash Temporary files ltIMCgtservertmp
ndash Backups ltIMCgtserverdatacfgbak
bull Pay close attention to timestamps in imccfgbakdm log file ndash these may appear out of order
bull Restart IMC and synchronize devices when first adding new adapters
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 4
Introductions
Lindsay Hill northlandboy - httplkhillcom
Primoris New Zealand (HP Partner)
bull Network Management Consultant
bull Install Configure and Support HP IMC for medium-sized Enterprises
bull CCIE CISSP RHCE
Aaron Paxson Neelixx - httpmyteneonet
SVP Worldwide
bull Global Network Manager
bull HP IMC Customer
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 5
wwwnetopscommunitynet
Independent community forum dedicated to helping fellow engineers with installing using and extending IMC
GitHub repository of 3rd-party developed custom scripts and adapters ndash free to use
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Building device adapters
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 7
Device adapters - overview
bull IMC supports over 6000 devices through the use of device adapters
bull IMC has standardized functions and variables for configuration management ndash these cover config backup config deployment and image deployment
bull Adapters define how these functions are turned into device-specific commands using XML TCL and Perl
bull Fully supported system for writing your own adapters to support new devicesor add custom functions to solve your business problems
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 8
Device adapter directories
Each vendor has its own directory with subdirectories for specific adapters
ltIMCgtserverconfadaptersICC
Cisco
CiscoASA
CiscoCatNative
CiscoIOSGeneric
CiscoNX7K
CiscoSNMP
Hewlett Packard
HPGbE2C
HPProLiant
HPProcurve
HPProcurveMSM
HPProcurve3500
ltVendorgtadapter-indexxml - assigns sysOIDS to adapters
ltVendorgtltAdaptergtadapterxml describes services and points to other XML files used
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 9
Device adapters ndash files
XML files define capabilities while TCLExpect files are used for running commands
tcl
bull Carries out functions using ExpectTCL
bull Parameters passed in
bull CLI output parsed by Perl script
_Builder _Scriptxml
bull Maps commands to individual TCL files
bull Defines script prerequisites and mode ndash eg CLI TFTP
_Builderxml
bull Action definition
bull Defines required actions order steps ndash maps to commands
Adapterxml
bull Service definition for services offered by that adapter ndash common functions backup deployment
bull Points to specific XML files
adapter-indexxml
bull Maps sysOIDs to specific adapters
bull Can define default adapter
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 10
Sample content from F5 adapter
Device adapters ndash examples
F5adapter-indexxml ltxml version=10gt
lt--sysoid adapt adapter--gt
ltadaptersgt
lttype name=CLIrdquogt
ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltsysoidgt1361413375213443ltsysoidgt
ltversion series=F5BIG vrp= release=gt
ltdefaultver series=F5BIG vrp= release=gt
ltadaptergt
lttypegt
ltadaptersgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 11
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPadapterxml ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltversiongt100ltversiongt
ltservicesgt
ltservice name=CLICommongt
ltitem type=commongtF5_Common_CLIxmlltitemgt
ltservicegt
ltservice name=ConfigBackupgt
ltitem type=builder_definitiongtF5_Config_Backup_Builderxmlltitemgt
ltitem type=tcl_scriptgtF5_Config_Backup_Builder_Scriptxmlltitemgt
ltservicegt
ltservicesgt
ltadaptergt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 12
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPF5_Config_Backup_Builder_Scriptxml ltxml version=10gt
ltscriptsgt
ltcommand name=backup_running_config_ftp method=FTPgt
lterrorgtFailed to upload configuration to FTP server FTP server may be down or incorrectly specified command syntax may be incorrect or prompts may not be what was expectedlterrorgt
ltrequire-modegtexecltrequire-modegt
ltscriptgt
backup_running_config_ftptcl
ltscriptgt
ltcommandgt
ltscriptsgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 13
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPbackup_running_config_ftptcl
Identificationbackup_running_config_ftp
Purpose backup running config via ftp
set timeout $very_long_timeout
set sourceFile varlocalucsimc_icc_f5_cfgucs
ftp_trans_file true $sourceFile $TFTPFile
set timeout $standard_timeout
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 14
Quick recap IMC backup methods
File transfer methods
bull SNMP Read-Write and TFTPFTP
bull Telnet and TFTPFTP
bull SCPSFTP
bull CLI (TelnetSSH) + ldquoshow runrdquo (or equivalent)
Backup method selection
bull IMC tries SNMP first if adapter defined
bull Then tries file transfer method defined in configuration center -gt options
bull If that fails falls back to CLI
bull Canrsquot mix SNMP and SCPSFTP
Key is understanding methods and data flow direction
IMC Device SCP SFTP
FTP TFTP
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 15
Summary of steps involved
Build your own device adapter
bull Analyze your device
ndash What access methods does it support
ndash What commands do we need to run to take a backup Is this similar to any other device already supported by IMC
ndash Does it have both a startup and a running configuration
bull Configure IMC
ndash Add device model series and vendor to IMC Note sysOID
ndash Create new folder ltIMCgtserverconfadaptersICCltVendorgt
ndash Create new adapter folder ltIMCgtserverconfadaptersICCltVendorgtltAdapter_Namegt
bull Create adapter files ndash service definitions and TCL files
bull Restart IMC to pick up new adapter
bull Discover device (or synchronize if already in IMC)
bull Test
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 16
Live walkthrough
Live walk through of process of adding new device adapter for Fortinet system
Will cover process of adding new device creating adapter files and running a backup
Shows logfiles to look at for troubleshooting
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 17
Troubleshooting process
bull Check your credentials login type and file transfer mode
bull Know what backup method you expect to be used (SCP SFTP CLI TFTP FTP)
bull Manually run the sequence of backup commands first from the IMC server
bull Key log file is ltIMCgtserverconflogimccfgbakdmlog ndash tells you almost everything you need to know ndash but it takes some decoding
bull First check that the right adapter is being selected ndash look for lines like
ndash Device login type is 1dev_id=4AdaptName=CiscoASA
bull Follow log file ndash see which TCL files are being executed and what the results are
bull Check ltIMCgtservertmp for temporary session files created during execution ndash these show all the output created These are deleted on normal exit
bull Use Wireshark to inspect traffic if required
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 18
Lessons from the field
bull Copy and tweak an existing adapter if you can
bull Use unencrypted communications during development if possible ndash Wireshark can really help
bull Set timeouts to low values during debugging ndash ldquoset timeout 10rdquo
bull Keep it simple ndash start with just backups using just one method Add more later
bull Key locations
ndash Log file ltIMCgtserverconflogimccfgbakdmlog
ndash Temporary files ltIMCgtservertmp
ndash Backups ltIMCgtserverdatacfgbak
bull Pay close attention to timestamps in imccfgbakdm log file ndash these may appear out of order
bull Restart IMC and synchronize devices when first adding new adapters
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 5
wwwnetopscommunitynet
Independent community forum dedicated to helping fellow engineers with installing using and extending IMC
GitHub repository of 3rd-party developed custom scripts and adapters ndash free to use
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Building device adapters
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 7
Device adapters - overview
bull IMC supports over 6000 devices through the use of device adapters
bull IMC has standardized functions and variables for configuration management ndash these cover config backup config deployment and image deployment
bull Adapters define how these functions are turned into device-specific commands using XML TCL and Perl
bull Fully supported system for writing your own adapters to support new devicesor add custom functions to solve your business problems
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 8
Device adapter directories
Each vendor has its own directory with subdirectories for specific adapters
ltIMCgtserverconfadaptersICC
Cisco
CiscoASA
CiscoCatNative
CiscoIOSGeneric
CiscoNX7K
CiscoSNMP
Hewlett Packard
HPGbE2C
HPProLiant
HPProcurve
HPProcurveMSM
HPProcurve3500
ltVendorgtadapter-indexxml - assigns sysOIDS to adapters
ltVendorgtltAdaptergtadapterxml describes services and points to other XML files used
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 9
Device adapters ndash files
XML files define capabilities while TCLExpect files are used for running commands
tcl
bull Carries out functions using ExpectTCL
bull Parameters passed in
bull CLI output parsed by Perl script
_Builder _Scriptxml
bull Maps commands to individual TCL files
bull Defines script prerequisites and mode ndash eg CLI TFTP
_Builderxml
bull Action definition
bull Defines required actions order steps ndash maps to commands
Adapterxml
bull Service definition for services offered by that adapter ndash common functions backup deployment
bull Points to specific XML files
adapter-indexxml
bull Maps sysOIDs to specific adapters
bull Can define default adapter
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 10
Sample content from F5 adapter
Device adapters ndash examples
F5adapter-indexxml ltxml version=10gt
lt--sysoid adapt adapter--gt
ltadaptersgt
lttype name=CLIrdquogt
ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltsysoidgt1361413375213443ltsysoidgt
ltversion series=F5BIG vrp= release=gt
ltdefaultver series=F5BIG vrp= release=gt
ltadaptergt
lttypegt
ltadaptersgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 11
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPadapterxml ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltversiongt100ltversiongt
ltservicesgt
ltservice name=CLICommongt
ltitem type=commongtF5_Common_CLIxmlltitemgt
ltservicegt
ltservice name=ConfigBackupgt
ltitem type=builder_definitiongtF5_Config_Backup_Builderxmlltitemgt
ltitem type=tcl_scriptgtF5_Config_Backup_Builder_Scriptxmlltitemgt
ltservicegt
ltservicesgt
ltadaptergt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 12
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPF5_Config_Backup_Builder_Scriptxml ltxml version=10gt
ltscriptsgt
ltcommand name=backup_running_config_ftp method=FTPgt
lterrorgtFailed to upload configuration to FTP server FTP server may be down or incorrectly specified command syntax may be incorrect or prompts may not be what was expectedlterrorgt
ltrequire-modegtexecltrequire-modegt
ltscriptgt
backup_running_config_ftptcl
ltscriptgt
ltcommandgt
ltscriptsgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 13
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPbackup_running_config_ftptcl
Identificationbackup_running_config_ftp
Purpose backup running config via ftp
set timeout $very_long_timeout
set sourceFile varlocalucsimc_icc_f5_cfgucs
ftp_trans_file true $sourceFile $TFTPFile
set timeout $standard_timeout
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 14
Quick recap IMC backup methods
File transfer methods
bull SNMP Read-Write and TFTPFTP
bull Telnet and TFTPFTP
bull SCPSFTP
bull CLI (TelnetSSH) + ldquoshow runrdquo (or equivalent)
Backup method selection
bull IMC tries SNMP first if adapter defined
bull Then tries file transfer method defined in configuration center -gt options
bull If that fails falls back to CLI
bull Canrsquot mix SNMP and SCPSFTP
Key is understanding methods and data flow direction
IMC Device SCP SFTP
FTP TFTP
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 15
Summary of steps involved
Build your own device adapter
bull Analyze your device
ndash What access methods does it support
ndash What commands do we need to run to take a backup Is this similar to any other device already supported by IMC
ndash Does it have both a startup and a running configuration
bull Configure IMC
ndash Add device model series and vendor to IMC Note sysOID
ndash Create new folder ltIMCgtserverconfadaptersICCltVendorgt
ndash Create new adapter folder ltIMCgtserverconfadaptersICCltVendorgtltAdapter_Namegt
bull Create adapter files ndash service definitions and TCL files
bull Restart IMC to pick up new adapter
bull Discover device (or synchronize if already in IMC)
bull Test
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 16
Live walkthrough
Live walk through of process of adding new device adapter for Fortinet system
Will cover process of adding new device creating adapter files and running a backup
Shows logfiles to look at for troubleshooting
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 17
Troubleshooting process
bull Check your credentials login type and file transfer mode
bull Know what backup method you expect to be used (SCP SFTP CLI TFTP FTP)
bull Manually run the sequence of backup commands first from the IMC server
bull Key log file is ltIMCgtserverconflogimccfgbakdmlog ndash tells you almost everything you need to know ndash but it takes some decoding
bull First check that the right adapter is being selected ndash look for lines like
ndash Device login type is 1dev_id=4AdaptName=CiscoASA
bull Follow log file ndash see which TCL files are being executed and what the results are
bull Check ltIMCgtservertmp for temporary session files created during execution ndash these show all the output created These are deleted on normal exit
bull Use Wireshark to inspect traffic if required
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 18
Lessons from the field
bull Copy and tweak an existing adapter if you can
bull Use unencrypted communications during development if possible ndash Wireshark can really help
bull Set timeouts to low values during debugging ndash ldquoset timeout 10rdquo
bull Keep it simple ndash start with just backups using just one method Add more later
bull Key locations
ndash Log file ltIMCgtserverconflogimccfgbakdmlog
ndash Temporary files ltIMCgtservertmp
ndash Backups ltIMCgtserverdatacfgbak
bull Pay close attention to timestamps in imccfgbakdm log file ndash these may appear out of order
bull Restart IMC and synchronize devices when first adding new adapters
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Building device adapters
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 7
Device adapters - overview
bull IMC supports over 6000 devices through the use of device adapters
bull IMC has standardized functions and variables for configuration management ndash these cover config backup config deployment and image deployment
bull Adapters define how these functions are turned into device-specific commands using XML TCL and Perl
bull Fully supported system for writing your own adapters to support new devicesor add custom functions to solve your business problems
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 8
Device adapter directories
Each vendor has its own directory with subdirectories for specific adapters
ltIMCgtserverconfadaptersICC
Cisco
CiscoASA
CiscoCatNative
CiscoIOSGeneric
CiscoNX7K
CiscoSNMP
Hewlett Packard
HPGbE2C
HPProLiant
HPProcurve
HPProcurveMSM
HPProcurve3500
ltVendorgtadapter-indexxml - assigns sysOIDS to adapters
ltVendorgtltAdaptergtadapterxml describes services and points to other XML files used
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 9
Device adapters ndash files
XML files define capabilities while TCLExpect files are used for running commands
tcl
bull Carries out functions using ExpectTCL
bull Parameters passed in
bull CLI output parsed by Perl script
_Builder _Scriptxml
bull Maps commands to individual TCL files
bull Defines script prerequisites and mode ndash eg CLI TFTP
_Builderxml
bull Action definition
bull Defines required actions order steps ndash maps to commands
Adapterxml
bull Service definition for services offered by that adapter ndash common functions backup deployment
bull Points to specific XML files
adapter-indexxml
bull Maps sysOIDs to specific adapters
bull Can define default adapter
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 10
Sample content from F5 adapter
Device adapters ndash examples
F5adapter-indexxml ltxml version=10gt
lt--sysoid adapt adapter--gt
ltadaptersgt
lttype name=CLIrdquogt
ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltsysoidgt1361413375213443ltsysoidgt
ltversion series=F5BIG vrp= release=gt
ltdefaultver series=F5BIG vrp= release=gt
ltadaptergt
lttypegt
ltadaptersgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 11
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPadapterxml ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltversiongt100ltversiongt
ltservicesgt
ltservice name=CLICommongt
ltitem type=commongtF5_Common_CLIxmlltitemgt
ltservicegt
ltservice name=ConfigBackupgt
ltitem type=builder_definitiongtF5_Config_Backup_Builderxmlltitemgt
ltitem type=tcl_scriptgtF5_Config_Backup_Builder_Scriptxmlltitemgt
ltservicegt
ltservicesgt
ltadaptergt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 12
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPF5_Config_Backup_Builder_Scriptxml ltxml version=10gt
ltscriptsgt
ltcommand name=backup_running_config_ftp method=FTPgt
lterrorgtFailed to upload configuration to FTP server FTP server may be down or incorrectly specified command syntax may be incorrect or prompts may not be what was expectedlterrorgt
ltrequire-modegtexecltrequire-modegt
ltscriptgt
backup_running_config_ftptcl
ltscriptgt
ltcommandgt
ltscriptsgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 13
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPbackup_running_config_ftptcl
Identificationbackup_running_config_ftp
Purpose backup running config via ftp
set timeout $very_long_timeout
set sourceFile varlocalucsimc_icc_f5_cfgucs
ftp_trans_file true $sourceFile $TFTPFile
set timeout $standard_timeout
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 14
Quick recap IMC backup methods
File transfer methods
bull SNMP Read-Write and TFTPFTP
bull Telnet and TFTPFTP
bull SCPSFTP
bull CLI (TelnetSSH) + ldquoshow runrdquo (or equivalent)
Backup method selection
bull IMC tries SNMP first if adapter defined
bull Then tries file transfer method defined in configuration center -gt options
bull If that fails falls back to CLI
bull Canrsquot mix SNMP and SCPSFTP
Key is understanding methods and data flow direction
IMC Device SCP SFTP
FTP TFTP
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 15
Summary of steps involved
Build your own device adapter
bull Analyze your device
ndash What access methods does it support
ndash What commands do we need to run to take a backup Is this similar to any other device already supported by IMC
ndash Does it have both a startup and a running configuration
bull Configure IMC
ndash Add device model series and vendor to IMC Note sysOID
ndash Create new folder ltIMCgtserverconfadaptersICCltVendorgt
ndash Create new adapter folder ltIMCgtserverconfadaptersICCltVendorgtltAdapter_Namegt
bull Create adapter files ndash service definitions and TCL files
bull Restart IMC to pick up new adapter
bull Discover device (or synchronize if already in IMC)
bull Test
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 16
Live walkthrough
Live walk through of process of adding new device adapter for Fortinet system
Will cover process of adding new device creating adapter files and running a backup
Shows logfiles to look at for troubleshooting
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 17
Troubleshooting process
bull Check your credentials login type and file transfer mode
bull Know what backup method you expect to be used (SCP SFTP CLI TFTP FTP)
bull Manually run the sequence of backup commands first from the IMC server
bull Key log file is ltIMCgtserverconflogimccfgbakdmlog ndash tells you almost everything you need to know ndash but it takes some decoding
bull First check that the right adapter is being selected ndash look for lines like
ndash Device login type is 1dev_id=4AdaptName=CiscoASA
bull Follow log file ndash see which TCL files are being executed and what the results are
bull Check ltIMCgtservertmp for temporary session files created during execution ndash these show all the output created These are deleted on normal exit
bull Use Wireshark to inspect traffic if required
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 18
Lessons from the field
bull Copy and tweak an existing adapter if you can
bull Use unencrypted communications during development if possible ndash Wireshark can really help
bull Set timeouts to low values during debugging ndash ldquoset timeout 10rdquo
bull Keep it simple ndash start with just backups using just one method Add more later
bull Key locations
ndash Log file ltIMCgtserverconflogimccfgbakdmlog
ndash Temporary files ltIMCgtservertmp
ndash Backups ltIMCgtserverdatacfgbak
bull Pay close attention to timestamps in imccfgbakdm log file ndash these may appear out of order
bull Restart IMC and synchronize devices when first adding new adapters
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 7
Device adapters - overview
bull IMC supports over 6000 devices through the use of device adapters
bull IMC has standardized functions and variables for configuration management ndash these cover config backup config deployment and image deployment
bull Adapters define how these functions are turned into device-specific commands using XML TCL and Perl
bull Fully supported system for writing your own adapters to support new devicesor add custom functions to solve your business problems
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 8
Device adapter directories
Each vendor has its own directory with subdirectories for specific adapters
ltIMCgtserverconfadaptersICC
Cisco
CiscoASA
CiscoCatNative
CiscoIOSGeneric
CiscoNX7K
CiscoSNMP
Hewlett Packard
HPGbE2C
HPProLiant
HPProcurve
HPProcurveMSM
HPProcurve3500
ltVendorgtadapter-indexxml - assigns sysOIDS to adapters
ltVendorgtltAdaptergtadapterxml describes services and points to other XML files used
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 9
Device adapters ndash files
XML files define capabilities while TCLExpect files are used for running commands
tcl
bull Carries out functions using ExpectTCL
bull Parameters passed in
bull CLI output parsed by Perl script
_Builder _Scriptxml
bull Maps commands to individual TCL files
bull Defines script prerequisites and mode ndash eg CLI TFTP
_Builderxml
bull Action definition
bull Defines required actions order steps ndash maps to commands
Adapterxml
bull Service definition for services offered by that adapter ndash common functions backup deployment
bull Points to specific XML files
adapter-indexxml
bull Maps sysOIDs to specific adapters
bull Can define default adapter
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 10
Sample content from F5 adapter
Device adapters ndash examples
F5adapter-indexxml ltxml version=10gt
lt--sysoid adapt adapter--gt
ltadaptersgt
lttype name=CLIrdquogt
ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltsysoidgt1361413375213443ltsysoidgt
ltversion series=F5BIG vrp= release=gt
ltdefaultver series=F5BIG vrp= release=gt
ltadaptergt
lttypegt
ltadaptersgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 11
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPadapterxml ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltversiongt100ltversiongt
ltservicesgt
ltservice name=CLICommongt
ltitem type=commongtF5_Common_CLIxmlltitemgt
ltservicegt
ltservice name=ConfigBackupgt
ltitem type=builder_definitiongtF5_Config_Backup_Builderxmlltitemgt
ltitem type=tcl_scriptgtF5_Config_Backup_Builder_Scriptxmlltitemgt
ltservicegt
ltservicesgt
ltadaptergt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 12
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPF5_Config_Backup_Builder_Scriptxml ltxml version=10gt
ltscriptsgt
ltcommand name=backup_running_config_ftp method=FTPgt
lterrorgtFailed to upload configuration to FTP server FTP server may be down or incorrectly specified command syntax may be incorrect or prompts may not be what was expectedlterrorgt
ltrequire-modegtexecltrequire-modegt
ltscriptgt
backup_running_config_ftptcl
ltscriptgt
ltcommandgt
ltscriptsgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 13
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPbackup_running_config_ftptcl
Identificationbackup_running_config_ftp
Purpose backup running config via ftp
set timeout $very_long_timeout
set sourceFile varlocalucsimc_icc_f5_cfgucs
ftp_trans_file true $sourceFile $TFTPFile
set timeout $standard_timeout
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 14
Quick recap IMC backup methods
File transfer methods
bull SNMP Read-Write and TFTPFTP
bull Telnet and TFTPFTP
bull SCPSFTP
bull CLI (TelnetSSH) + ldquoshow runrdquo (or equivalent)
Backup method selection
bull IMC tries SNMP first if adapter defined
bull Then tries file transfer method defined in configuration center -gt options
bull If that fails falls back to CLI
bull Canrsquot mix SNMP and SCPSFTP
Key is understanding methods and data flow direction
IMC Device SCP SFTP
FTP TFTP
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 15
Summary of steps involved
Build your own device adapter
bull Analyze your device
ndash What access methods does it support
ndash What commands do we need to run to take a backup Is this similar to any other device already supported by IMC
ndash Does it have both a startup and a running configuration
bull Configure IMC
ndash Add device model series and vendor to IMC Note sysOID
ndash Create new folder ltIMCgtserverconfadaptersICCltVendorgt
ndash Create new adapter folder ltIMCgtserverconfadaptersICCltVendorgtltAdapter_Namegt
bull Create adapter files ndash service definitions and TCL files
bull Restart IMC to pick up new adapter
bull Discover device (or synchronize if already in IMC)
bull Test
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 16
Live walkthrough
Live walk through of process of adding new device adapter for Fortinet system
Will cover process of adding new device creating adapter files and running a backup
Shows logfiles to look at for troubleshooting
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 17
Troubleshooting process
bull Check your credentials login type and file transfer mode
bull Know what backup method you expect to be used (SCP SFTP CLI TFTP FTP)
bull Manually run the sequence of backup commands first from the IMC server
bull Key log file is ltIMCgtserverconflogimccfgbakdmlog ndash tells you almost everything you need to know ndash but it takes some decoding
bull First check that the right adapter is being selected ndash look for lines like
ndash Device login type is 1dev_id=4AdaptName=CiscoASA
bull Follow log file ndash see which TCL files are being executed and what the results are
bull Check ltIMCgtservertmp for temporary session files created during execution ndash these show all the output created These are deleted on normal exit
bull Use Wireshark to inspect traffic if required
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 18
Lessons from the field
bull Copy and tweak an existing adapter if you can
bull Use unencrypted communications during development if possible ndash Wireshark can really help
bull Set timeouts to low values during debugging ndash ldquoset timeout 10rdquo
bull Keep it simple ndash start with just backups using just one method Add more later
bull Key locations
ndash Log file ltIMCgtserverconflogimccfgbakdmlog
ndash Temporary files ltIMCgtservertmp
ndash Backups ltIMCgtserverdatacfgbak
bull Pay close attention to timestamps in imccfgbakdm log file ndash these may appear out of order
bull Restart IMC and synchronize devices when first adding new adapters
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 8
Device adapter directories
Each vendor has its own directory with subdirectories for specific adapters
ltIMCgtserverconfadaptersICC
Cisco
CiscoASA
CiscoCatNative
CiscoIOSGeneric
CiscoNX7K
CiscoSNMP
Hewlett Packard
HPGbE2C
HPProLiant
HPProcurve
HPProcurveMSM
HPProcurve3500
ltVendorgtadapter-indexxml - assigns sysOIDS to adapters
ltVendorgtltAdaptergtadapterxml describes services and points to other XML files used
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 9
Device adapters ndash files
XML files define capabilities while TCLExpect files are used for running commands
tcl
bull Carries out functions using ExpectTCL
bull Parameters passed in
bull CLI output parsed by Perl script
_Builder _Scriptxml
bull Maps commands to individual TCL files
bull Defines script prerequisites and mode ndash eg CLI TFTP
_Builderxml
bull Action definition
bull Defines required actions order steps ndash maps to commands
Adapterxml
bull Service definition for services offered by that adapter ndash common functions backup deployment
bull Points to specific XML files
adapter-indexxml
bull Maps sysOIDs to specific adapters
bull Can define default adapter
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 10
Sample content from F5 adapter
Device adapters ndash examples
F5adapter-indexxml ltxml version=10gt
lt--sysoid adapt adapter--gt
ltadaptersgt
lttype name=CLIrdquogt
ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltsysoidgt1361413375213443ltsysoidgt
ltversion series=F5BIG vrp= release=gt
ltdefaultver series=F5BIG vrp= release=gt
ltadaptergt
lttypegt
ltadaptersgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 11
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPadapterxml ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltversiongt100ltversiongt
ltservicesgt
ltservice name=CLICommongt
ltitem type=commongtF5_Common_CLIxmlltitemgt
ltservicegt
ltservice name=ConfigBackupgt
ltitem type=builder_definitiongtF5_Config_Backup_Builderxmlltitemgt
ltitem type=tcl_scriptgtF5_Config_Backup_Builder_Scriptxmlltitemgt
ltservicegt
ltservicesgt
ltadaptergt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 12
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPF5_Config_Backup_Builder_Scriptxml ltxml version=10gt
ltscriptsgt
ltcommand name=backup_running_config_ftp method=FTPgt
lterrorgtFailed to upload configuration to FTP server FTP server may be down or incorrectly specified command syntax may be incorrect or prompts may not be what was expectedlterrorgt
ltrequire-modegtexecltrequire-modegt
ltscriptgt
backup_running_config_ftptcl
ltscriptgt
ltcommandgt
ltscriptsgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 13
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPbackup_running_config_ftptcl
Identificationbackup_running_config_ftp
Purpose backup running config via ftp
set timeout $very_long_timeout
set sourceFile varlocalucsimc_icc_f5_cfgucs
ftp_trans_file true $sourceFile $TFTPFile
set timeout $standard_timeout
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 14
Quick recap IMC backup methods
File transfer methods
bull SNMP Read-Write and TFTPFTP
bull Telnet and TFTPFTP
bull SCPSFTP
bull CLI (TelnetSSH) + ldquoshow runrdquo (or equivalent)
Backup method selection
bull IMC tries SNMP first if adapter defined
bull Then tries file transfer method defined in configuration center -gt options
bull If that fails falls back to CLI
bull Canrsquot mix SNMP and SCPSFTP
Key is understanding methods and data flow direction
IMC Device SCP SFTP
FTP TFTP
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 15
Summary of steps involved
Build your own device adapter
bull Analyze your device
ndash What access methods does it support
ndash What commands do we need to run to take a backup Is this similar to any other device already supported by IMC
ndash Does it have both a startup and a running configuration
bull Configure IMC
ndash Add device model series and vendor to IMC Note sysOID
ndash Create new folder ltIMCgtserverconfadaptersICCltVendorgt
ndash Create new adapter folder ltIMCgtserverconfadaptersICCltVendorgtltAdapter_Namegt
bull Create adapter files ndash service definitions and TCL files
bull Restart IMC to pick up new adapter
bull Discover device (or synchronize if already in IMC)
bull Test
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 16
Live walkthrough
Live walk through of process of adding new device adapter for Fortinet system
Will cover process of adding new device creating adapter files and running a backup
Shows logfiles to look at for troubleshooting
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 17
Troubleshooting process
bull Check your credentials login type and file transfer mode
bull Know what backup method you expect to be used (SCP SFTP CLI TFTP FTP)
bull Manually run the sequence of backup commands first from the IMC server
bull Key log file is ltIMCgtserverconflogimccfgbakdmlog ndash tells you almost everything you need to know ndash but it takes some decoding
bull First check that the right adapter is being selected ndash look for lines like
ndash Device login type is 1dev_id=4AdaptName=CiscoASA
bull Follow log file ndash see which TCL files are being executed and what the results are
bull Check ltIMCgtservertmp for temporary session files created during execution ndash these show all the output created These are deleted on normal exit
bull Use Wireshark to inspect traffic if required
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 18
Lessons from the field
bull Copy and tweak an existing adapter if you can
bull Use unencrypted communications during development if possible ndash Wireshark can really help
bull Set timeouts to low values during debugging ndash ldquoset timeout 10rdquo
bull Keep it simple ndash start with just backups using just one method Add more later
bull Key locations
ndash Log file ltIMCgtserverconflogimccfgbakdmlog
ndash Temporary files ltIMCgtservertmp
ndash Backups ltIMCgtserverdatacfgbak
bull Pay close attention to timestamps in imccfgbakdm log file ndash these may appear out of order
bull Restart IMC and synchronize devices when first adding new adapters
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 9
Device adapters ndash files
XML files define capabilities while TCLExpect files are used for running commands
tcl
bull Carries out functions using ExpectTCL
bull Parameters passed in
bull CLI output parsed by Perl script
_Builder _Scriptxml
bull Maps commands to individual TCL files
bull Defines script prerequisites and mode ndash eg CLI TFTP
_Builderxml
bull Action definition
bull Defines required actions order steps ndash maps to commands
Adapterxml
bull Service definition for services offered by that adapter ndash common functions backup deployment
bull Points to specific XML files
adapter-indexxml
bull Maps sysOIDs to specific adapters
bull Can define default adapter
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 10
Sample content from F5 adapter
Device adapters ndash examples
F5adapter-indexxml ltxml version=10gt
lt--sysoid adapt adapter--gt
ltadaptersgt
lttype name=CLIrdquogt
ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltsysoidgt1361413375213443ltsysoidgt
ltversion series=F5BIG vrp= release=gt
ltdefaultver series=F5BIG vrp= release=gt
ltadaptergt
lttypegt
ltadaptersgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 11
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPadapterxml ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltversiongt100ltversiongt
ltservicesgt
ltservice name=CLICommongt
ltitem type=commongtF5_Common_CLIxmlltitemgt
ltservicegt
ltservice name=ConfigBackupgt
ltitem type=builder_definitiongtF5_Config_Backup_Builderxmlltitemgt
ltitem type=tcl_scriptgtF5_Config_Backup_Builder_Scriptxmlltitemgt
ltservicegt
ltservicesgt
ltadaptergt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 12
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPF5_Config_Backup_Builder_Scriptxml ltxml version=10gt
ltscriptsgt
ltcommand name=backup_running_config_ftp method=FTPgt
lterrorgtFailed to upload configuration to FTP server FTP server may be down or incorrectly specified command syntax may be incorrect or prompts may not be what was expectedlterrorgt
ltrequire-modegtexecltrequire-modegt
ltscriptgt
backup_running_config_ftptcl
ltscriptgt
ltcommandgt
ltscriptsgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 13
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPbackup_running_config_ftptcl
Identificationbackup_running_config_ftp
Purpose backup running config via ftp
set timeout $very_long_timeout
set sourceFile varlocalucsimc_icc_f5_cfgucs
ftp_trans_file true $sourceFile $TFTPFile
set timeout $standard_timeout
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 14
Quick recap IMC backup methods
File transfer methods
bull SNMP Read-Write and TFTPFTP
bull Telnet and TFTPFTP
bull SCPSFTP
bull CLI (TelnetSSH) + ldquoshow runrdquo (or equivalent)
Backup method selection
bull IMC tries SNMP first if adapter defined
bull Then tries file transfer method defined in configuration center -gt options
bull If that fails falls back to CLI
bull Canrsquot mix SNMP and SCPSFTP
Key is understanding methods and data flow direction
IMC Device SCP SFTP
FTP TFTP
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 15
Summary of steps involved
Build your own device adapter
bull Analyze your device
ndash What access methods does it support
ndash What commands do we need to run to take a backup Is this similar to any other device already supported by IMC
ndash Does it have both a startup and a running configuration
bull Configure IMC
ndash Add device model series and vendor to IMC Note sysOID
ndash Create new folder ltIMCgtserverconfadaptersICCltVendorgt
ndash Create new adapter folder ltIMCgtserverconfadaptersICCltVendorgtltAdapter_Namegt
bull Create adapter files ndash service definitions and TCL files
bull Restart IMC to pick up new adapter
bull Discover device (or synchronize if already in IMC)
bull Test
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 16
Live walkthrough
Live walk through of process of adding new device adapter for Fortinet system
Will cover process of adding new device creating adapter files and running a backup
Shows logfiles to look at for troubleshooting
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 17
Troubleshooting process
bull Check your credentials login type and file transfer mode
bull Know what backup method you expect to be used (SCP SFTP CLI TFTP FTP)
bull Manually run the sequence of backup commands first from the IMC server
bull Key log file is ltIMCgtserverconflogimccfgbakdmlog ndash tells you almost everything you need to know ndash but it takes some decoding
bull First check that the right adapter is being selected ndash look for lines like
ndash Device login type is 1dev_id=4AdaptName=CiscoASA
bull Follow log file ndash see which TCL files are being executed and what the results are
bull Check ltIMCgtservertmp for temporary session files created during execution ndash these show all the output created These are deleted on normal exit
bull Use Wireshark to inspect traffic if required
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 18
Lessons from the field
bull Copy and tweak an existing adapter if you can
bull Use unencrypted communications during development if possible ndash Wireshark can really help
bull Set timeouts to low values during debugging ndash ldquoset timeout 10rdquo
bull Keep it simple ndash start with just backups using just one method Add more later
bull Key locations
ndash Log file ltIMCgtserverconflogimccfgbakdmlog
ndash Temporary files ltIMCgtservertmp
ndash Backups ltIMCgtserverdatacfgbak
bull Pay close attention to timestamps in imccfgbakdm log file ndash these may appear out of order
bull Restart IMC and synchronize devices when first adding new adapters
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 10
Sample content from F5 adapter
Device adapters ndash examples
F5adapter-indexxml ltxml version=10gt
lt--sysoid adapt adapter--gt
ltadaptersgt
lttype name=CLIrdquogt
ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltsysoidgt1361413375213443ltsysoidgt
ltversion series=F5BIG vrp= release=gt
ltdefaultver series=F5BIG vrp= release=gt
ltadaptergt
lttypegt
ltadaptersgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 11
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPadapterxml ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltversiongt100ltversiongt
ltservicesgt
ltservice name=CLICommongt
ltitem type=commongtF5_Common_CLIxmlltitemgt
ltservicegt
ltservice name=ConfigBackupgt
ltitem type=builder_definitiongtF5_Config_Backup_Builderxmlltitemgt
ltitem type=tcl_scriptgtF5_Config_Backup_Builder_Scriptxmlltitemgt
ltservicegt
ltservicesgt
ltadaptergt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 12
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPF5_Config_Backup_Builder_Scriptxml ltxml version=10gt
ltscriptsgt
ltcommand name=backup_running_config_ftp method=FTPgt
lterrorgtFailed to upload configuration to FTP server FTP server may be down or incorrectly specified command syntax may be incorrect or prompts may not be what was expectedlterrorgt
ltrequire-modegtexecltrequire-modegt
ltscriptgt
backup_running_config_ftptcl
ltscriptgt
ltcommandgt
ltscriptsgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 13
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPbackup_running_config_ftptcl
Identificationbackup_running_config_ftp
Purpose backup running config via ftp
set timeout $very_long_timeout
set sourceFile varlocalucsimc_icc_f5_cfgucs
ftp_trans_file true $sourceFile $TFTPFile
set timeout $standard_timeout
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 14
Quick recap IMC backup methods
File transfer methods
bull SNMP Read-Write and TFTPFTP
bull Telnet and TFTPFTP
bull SCPSFTP
bull CLI (TelnetSSH) + ldquoshow runrdquo (or equivalent)
Backup method selection
bull IMC tries SNMP first if adapter defined
bull Then tries file transfer method defined in configuration center -gt options
bull If that fails falls back to CLI
bull Canrsquot mix SNMP and SCPSFTP
Key is understanding methods and data flow direction
IMC Device SCP SFTP
FTP TFTP
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 15
Summary of steps involved
Build your own device adapter
bull Analyze your device
ndash What access methods does it support
ndash What commands do we need to run to take a backup Is this similar to any other device already supported by IMC
ndash Does it have both a startup and a running configuration
bull Configure IMC
ndash Add device model series and vendor to IMC Note sysOID
ndash Create new folder ltIMCgtserverconfadaptersICCltVendorgt
ndash Create new adapter folder ltIMCgtserverconfadaptersICCltVendorgtltAdapter_Namegt
bull Create adapter files ndash service definitions and TCL files
bull Restart IMC to pick up new adapter
bull Discover device (or synchronize if already in IMC)
bull Test
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 16
Live walkthrough
Live walk through of process of adding new device adapter for Fortinet system
Will cover process of adding new device creating adapter files and running a backup
Shows logfiles to look at for troubleshooting
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 17
Troubleshooting process
bull Check your credentials login type and file transfer mode
bull Know what backup method you expect to be used (SCP SFTP CLI TFTP FTP)
bull Manually run the sequence of backup commands first from the IMC server
bull Key log file is ltIMCgtserverconflogimccfgbakdmlog ndash tells you almost everything you need to know ndash but it takes some decoding
bull First check that the right adapter is being selected ndash look for lines like
ndash Device login type is 1dev_id=4AdaptName=CiscoASA
bull Follow log file ndash see which TCL files are being executed and what the results are
bull Check ltIMCgtservertmp for temporary session files created during execution ndash these show all the output created These are deleted on normal exit
bull Use Wireshark to inspect traffic if required
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 18
Lessons from the field
bull Copy and tweak an existing adapter if you can
bull Use unencrypted communications during development if possible ndash Wireshark can really help
bull Set timeouts to low values during debugging ndash ldquoset timeout 10rdquo
bull Keep it simple ndash start with just backups using just one method Add more later
bull Key locations
ndash Log file ltIMCgtserverconflogimccfgbakdmlog
ndash Temporary files ltIMCgtservertmp
ndash Backups ltIMCgtserverdatacfgbak
bull Pay close attention to timestamps in imccfgbakdm log file ndash these may appear out of order
bull Restart IMC and synchronize devices when first adding new adapters
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 11
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPadapterxml ltadapter name=F5BIGIPgt
ltdescriptiongtF5 (multi-config) load-balancers Big-IP seriesltdescriptiongt
ltversiongt100ltversiongt
ltservicesgt
ltservice name=CLICommongt
ltitem type=commongtF5_Common_CLIxmlltitemgt
ltservicegt
ltservice name=ConfigBackupgt
ltitem type=builder_definitiongtF5_Config_Backup_Builderxmlltitemgt
ltitem type=tcl_scriptgtF5_Config_Backup_Builder_Scriptxmlltitemgt
ltservicegt
ltservicesgt
ltadaptergt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 12
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPF5_Config_Backup_Builder_Scriptxml ltxml version=10gt
ltscriptsgt
ltcommand name=backup_running_config_ftp method=FTPgt
lterrorgtFailed to upload configuration to FTP server FTP server may be down or incorrectly specified command syntax may be incorrect or prompts may not be what was expectedlterrorgt
ltrequire-modegtexecltrequire-modegt
ltscriptgt
backup_running_config_ftptcl
ltscriptgt
ltcommandgt
ltscriptsgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 13
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPbackup_running_config_ftptcl
Identificationbackup_running_config_ftp
Purpose backup running config via ftp
set timeout $very_long_timeout
set sourceFile varlocalucsimc_icc_f5_cfgucs
ftp_trans_file true $sourceFile $TFTPFile
set timeout $standard_timeout
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 14
Quick recap IMC backup methods
File transfer methods
bull SNMP Read-Write and TFTPFTP
bull Telnet and TFTPFTP
bull SCPSFTP
bull CLI (TelnetSSH) + ldquoshow runrdquo (or equivalent)
Backup method selection
bull IMC tries SNMP first if adapter defined
bull Then tries file transfer method defined in configuration center -gt options
bull If that fails falls back to CLI
bull Canrsquot mix SNMP and SCPSFTP
Key is understanding methods and data flow direction
IMC Device SCP SFTP
FTP TFTP
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 15
Summary of steps involved
Build your own device adapter
bull Analyze your device
ndash What access methods does it support
ndash What commands do we need to run to take a backup Is this similar to any other device already supported by IMC
ndash Does it have both a startup and a running configuration
bull Configure IMC
ndash Add device model series and vendor to IMC Note sysOID
ndash Create new folder ltIMCgtserverconfadaptersICCltVendorgt
ndash Create new adapter folder ltIMCgtserverconfadaptersICCltVendorgtltAdapter_Namegt
bull Create adapter files ndash service definitions and TCL files
bull Restart IMC to pick up new adapter
bull Discover device (or synchronize if already in IMC)
bull Test
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 16
Live walkthrough
Live walk through of process of adding new device adapter for Fortinet system
Will cover process of adding new device creating adapter files and running a backup
Shows logfiles to look at for troubleshooting
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 17
Troubleshooting process
bull Check your credentials login type and file transfer mode
bull Know what backup method you expect to be used (SCP SFTP CLI TFTP FTP)
bull Manually run the sequence of backup commands first from the IMC server
bull Key log file is ltIMCgtserverconflogimccfgbakdmlog ndash tells you almost everything you need to know ndash but it takes some decoding
bull First check that the right adapter is being selected ndash look for lines like
ndash Device login type is 1dev_id=4AdaptName=CiscoASA
bull Follow log file ndash see which TCL files are being executed and what the results are
bull Check ltIMCgtservertmp for temporary session files created during execution ndash these show all the output created These are deleted on normal exit
bull Use Wireshark to inspect traffic if required
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 18
Lessons from the field
bull Copy and tweak an existing adapter if you can
bull Use unencrypted communications during development if possible ndash Wireshark can really help
bull Set timeouts to low values during debugging ndash ldquoset timeout 10rdquo
bull Keep it simple ndash start with just backups using just one method Add more later
bull Key locations
ndash Log file ltIMCgtserverconflogimccfgbakdmlog
ndash Temporary files ltIMCgtservertmp
ndash Backups ltIMCgtserverdatacfgbak
bull Pay close attention to timestamps in imccfgbakdm log file ndash these may appear out of order
bull Restart IMC and synchronize devices when first adding new adapters
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 12
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPF5_Config_Backup_Builder_Scriptxml ltxml version=10gt
ltscriptsgt
ltcommand name=backup_running_config_ftp method=FTPgt
lterrorgtFailed to upload configuration to FTP server FTP server may be down or incorrectly specified command syntax may be incorrect or prompts may not be what was expectedlterrorgt
ltrequire-modegtexecltrequire-modegt
ltscriptgt
backup_running_config_ftptcl
ltscriptgt
ltcommandgt
ltscriptsgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 13
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPbackup_running_config_ftptcl
Identificationbackup_running_config_ftp
Purpose backup running config via ftp
set timeout $very_long_timeout
set sourceFile varlocalucsimc_icc_f5_cfgucs
ftp_trans_file true $sourceFile $TFTPFile
set timeout $standard_timeout
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 14
Quick recap IMC backup methods
File transfer methods
bull SNMP Read-Write and TFTPFTP
bull Telnet and TFTPFTP
bull SCPSFTP
bull CLI (TelnetSSH) + ldquoshow runrdquo (or equivalent)
Backup method selection
bull IMC tries SNMP first if adapter defined
bull Then tries file transfer method defined in configuration center -gt options
bull If that fails falls back to CLI
bull Canrsquot mix SNMP and SCPSFTP
Key is understanding methods and data flow direction
IMC Device SCP SFTP
FTP TFTP
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 15
Summary of steps involved
Build your own device adapter
bull Analyze your device
ndash What access methods does it support
ndash What commands do we need to run to take a backup Is this similar to any other device already supported by IMC
ndash Does it have both a startup and a running configuration
bull Configure IMC
ndash Add device model series and vendor to IMC Note sysOID
ndash Create new folder ltIMCgtserverconfadaptersICCltVendorgt
ndash Create new adapter folder ltIMCgtserverconfadaptersICCltVendorgtltAdapter_Namegt
bull Create adapter files ndash service definitions and TCL files
bull Restart IMC to pick up new adapter
bull Discover device (or synchronize if already in IMC)
bull Test
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 16
Live walkthrough
Live walk through of process of adding new device adapter for Fortinet system
Will cover process of adding new device creating adapter files and running a backup
Shows logfiles to look at for troubleshooting
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 17
Troubleshooting process
bull Check your credentials login type and file transfer mode
bull Know what backup method you expect to be used (SCP SFTP CLI TFTP FTP)
bull Manually run the sequence of backup commands first from the IMC server
bull Key log file is ltIMCgtserverconflogimccfgbakdmlog ndash tells you almost everything you need to know ndash but it takes some decoding
bull First check that the right adapter is being selected ndash look for lines like
ndash Device login type is 1dev_id=4AdaptName=CiscoASA
bull Follow log file ndash see which TCL files are being executed and what the results are
bull Check ltIMCgtservertmp for temporary session files created during execution ndash these show all the output created These are deleted on normal exit
bull Use Wireshark to inspect traffic if required
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 18
Lessons from the field
bull Copy and tweak an existing adapter if you can
bull Use unencrypted communications during development if possible ndash Wireshark can really help
bull Set timeouts to low values during debugging ndash ldquoset timeout 10rdquo
bull Keep it simple ndash start with just backups using just one method Add more later
bull Key locations
ndash Log file ltIMCgtserverconflogimccfgbakdmlog
ndash Temporary files ltIMCgtservertmp
ndash Backups ltIMCgtserverdatacfgbak
bull Pay close attention to timestamps in imccfgbakdm log file ndash these may appear out of order
bull Restart IMC and synchronize devices when first adding new adapters
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 13
Sample content from F5 adapter (continued)
Device adapters ndash examples
F5F5BIGIPbackup_running_config_ftptcl
Identificationbackup_running_config_ftp
Purpose backup running config via ftp
set timeout $very_long_timeout
set sourceFile varlocalucsimc_icc_f5_cfgucs
ftp_trans_file true $sourceFile $TFTPFile
set timeout $standard_timeout
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 14
Quick recap IMC backup methods
File transfer methods
bull SNMP Read-Write and TFTPFTP
bull Telnet and TFTPFTP
bull SCPSFTP
bull CLI (TelnetSSH) + ldquoshow runrdquo (or equivalent)
Backup method selection
bull IMC tries SNMP first if adapter defined
bull Then tries file transfer method defined in configuration center -gt options
bull If that fails falls back to CLI
bull Canrsquot mix SNMP and SCPSFTP
Key is understanding methods and data flow direction
IMC Device SCP SFTP
FTP TFTP
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 15
Summary of steps involved
Build your own device adapter
bull Analyze your device
ndash What access methods does it support
ndash What commands do we need to run to take a backup Is this similar to any other device already supported by IMC
ndash Does it have both a startup and a running configuration
bull Configure IMC
ndash Add device model series and vendor to IMC Note sysOID
ndash Create new folder ltIMCgtserverconfadaptersICCltVendorgt
ndash Create new adapter folder ltIMCgtserverconfadaptersICCltVendorgtltAdapter_Namegt
bull Create adapter files ndash service definitions and TCL files
bull Restart IMC to pick up new adapter
bull Discover device (or synchronize if already in IMC)
bull Test
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 16
Live walkthrough
Live walk through of process of adding new device adapter for Fortinet system
Will cover process of adding new device creating adapter files and running a backup
Shows logfiles to look at for troubleshooting
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 17
Troubleshooting process
bull Check your credentials login type and file transfer mode
bull Know what backup method you expect to be used (SCP SFTP CLI TFTP FTP)
bull Manually run the sequence of backup commands first from the IMC server
bull Key log file is ltIMCgtserverconflogimccfgbakdmlog ndash tells you almost everything you need to know ndash but it takes some decoding
bull First check that the right adapter is being selected ndash look for lines like
ndash Device login type is 1dev_id=4AdaptName=CiscoASA
bull Follow log file ndash see which TCL files are being executed and what the results are
bull Check ltIMCgtservertmp for temporary session files created during execution ndash these show all the output created These are deleted on normal exit
bull Use Wireshark to inspect traffic if required
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 18
Lessons from the field
bull Copy and tweak an existing adapter if you can
bull Use unencrypted communications during development if possible ndash Wireshark can really help
bull Set timeouts to low values during debugging ndash ldquoset timeout 10rdquo
bull Keep it simple ndash start with just backups using just one method Add more later
bull Key locations
ndash Log file ltIMCgtserverconflogimccfgbakdmlog
ndash Temporary files ltIMCgtservertmp
ndash Backups ltIMCgtserverdatacfgbak
bull Pay close attention to timestamps in imccfgbakdm log file ndash these may appear out of order
bull Restart IMC and synchronize devices when first adding new adapters
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 14
Quick recap IMC backup methods
File transfer methods
bull SNMP Read-Write and TFTPFTP
bull Telnet and TFTPFTP
bull SCPSFTP
bull CLI (TelnetSSH) + ldquoshow runrdquo (or equivalent)
Backup method selection
bull IMC tries SNMP first if adapter defined
bull Then tries file transfer method defined in configuration center -gt options
bull If that fails falls back to CLI
bull Canrsquot mix SNMP and SCPSFTP
Key is understanding methods and data flow direction
IMC Device SCP SFTP
FTP TFTP
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 15
Summary of steps involved
Build your own device adapter
bull Analyze your device
ndash What access methods does it support
ndash What commands do we need to run to take a backup Is this similar to any other device already supported by IMC
ndash Does it have both a startup and a running configuration
bull Configure IMC
ndash Add device model series and vendor to IMC Note sysOID
ndash Create new folder ltIMCgtserverconfadaptersICCltVendorgt
ndash Create new adapter folder ltIMCgtserverconfadaptersICCltVendorgtltAdapter_Namegt
bull Create adapter files ndash service definitions and TCL files
bull Restart IMC to pick up new adapter
bull Discover device (or synchronize if already in IMC)
bull Test
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 16
Live walkthrough
Live walk through of process of adding new device adapter for Fortinet system
Will cover process of adding new device creating adapter files and running a backup
Shows logfiles to look at for troubleshooting
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 17
Troubleshooting process
bull Check your credentials login type and file transfer mode
bull Know what backup method you expect to be used (SCP SFTP CLI TFTP FTP)
bull Manually run the sequence of backup commands first from the IMC server
bull Key log file is ltIMCgtserverconflogimccfgbakdmlog ndash tells you almost everything you need to know ndash but it takes some decoding
bull First check that the right adapter is being selected ndash look for lines like
ndash Device login type is 1dev_id=4AdaptName=CiscoASA
bull Follow log file ndash see which TCL files are being executed and what the results are
bull Check ltIMCgtservertmp for temporary session files created during execution ndash these show all the output created These are deleted on normal exit
bull Use Wireshark to inspect traffic if required
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 18
Lessons from the field
bull Copy and tweak an existing adapter if you can
bull Use unencrypted communications during development if possible ndash Wireshark can really help
bull Set timeouts to low values during debugging ndash ldquoset timeout 10rdquo
bull Keep it simple ndash start with just backups using just one method Add more later
bull Key locations
ndash Log file ltIMCgtserverconflogimccfgbakdmlog
ndash Temporary files ltIMCgtservertmp
ndash Backups ltIMCgtserverdatacfgbak
bull Pay close attention to timestamps in imccfgbakdm log file ndash these may appear out of order
bull Restart IMC and synchronize devices when first adding new adapters
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 15
Summary of steps involved
Build your own device adapter
bull Analyze your device
ndash What access methods does it support
ndash What commands do we need to run to take a backup Is this similar to any other device already supported by IMC
ndash Does it have both a startup and a running configuration
bull Configure IMC
ndash Add device model series and vendor to IMC Note sysOID
ndash Create new folder ltIMCgtserverconfadaptersICCltVendorgt
ndash Create new adapter folder ltIMCgtserverconfadaptersICCltVendorgtltAdapter_Namegt
bull Create adapter files ndash service definitions and TCL files
bull Restart IMC to pick up new adapter
bull Discover device (or synchronize if already in IMC)
bull Test
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 16
Live walkthrough
Live walk through of process of adding new device adapter for Fortinet system
Will cover process of adding new device creating adapter files and running a backup
Shows logfiles to look at for troubleshooting
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 17
Troubleshooting process
bull Check your credentials login type and file transfer mode
bull Know what backup method you expect to be used (SCP SFTP CLI TFTP FTP)
bull Manually run the sequence of backup commands first from the IMC server
bull Key log file is ltIMCgtserverconflogimccfgbakdmlog ndash tells you almost everything you need to know ndash but it takes some decoding
bull First check that the right adapter is being selected ndash look for lines like
ndash Device login type is 1dev_id=4AdaptName=CiscoASA
bull Follow log file ndash see which TCL files are being executed and what the results are
bull Check ltIMCgtservertmp for temporary session files created during execution ndash these show all the output created These are deleted on normal exit
bull Use Wireshark to inspect traffic if required
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 18
Lessons from the field
bull Copy and tweak an existing adapter if you can
bull Use unencrypted communications during development if possible ndash Wireshark can really help
bull Set timeouts to low values during debugging ndash ldquoset timeout 10rdquo
bull Keep it simple ndash start with just backups using just one method Add more later
bull Key locations
ndash Log file ltIMCgtserverconflogimccfgbakdmlog
ndash Temporary files ltIMCgtservertmp
ndash Backups ltIMCgtserverdatacfgbak
bull Pay close attention to timestamps in imccfgbakdm log file ndash these may appear out of order
bull Restart IMC and synchronize devices when first adding new adapters
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 16
Live walkthrough
Live walk through of process of adding new device adapter for Fortinet system
Will cover process of adding new device creating adapter files and running a backup
Shows logfiles to look at for troubleshooting
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 17
Troubleshooting process
bull Check your credentials login type and file transfer mode
bull Know what backup method you expect to be used (SCP SFTP CLI TFTP FTP)
bull Manually run the sequence of backup commands first from the IMC server
bull Key log file is ltIMCgtserverconflogimccfgbakdmlog ndash tells you almost everything you need to know ndash but it takes some decoding
bull First check that the right adapter is being selected ndash look for lines like
ndash Device login type is 1dev_id=4AdaptName=CiscoASA
bull Follow log file ndash see which TCL files are being executed and what the results are
bull Check ltIMCgtservertmp for temporary session files created during execution ndash these show all the output created These are deleted on normal exit
bull Use Wireshark to inspect traffic if required
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 18
Lessons from the field
bull Copy and tweak an existing adapter if you can
bull Use unencrypted communications during development if possible ndash Wireshark can really help
bull Set timeouts to low values during debugging ndash ldquoset timeout 10rdquo
bull Keep it simple ndash start with just backups using just one method Add more later
bull Key locations
ndash Log file ltIMCgtserverconflogimccfgbakdmlog
ndash Temporary files ltIMCgtservertmp
ndash Backups ltIMCgtserverdatacfgbak
bull Pay close attention to timestamps in imccfgbakdm log file ndash these may appear out of order
bull Restart IMC and synchronize devices when first adding new adapters
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 17
Troubleshooting process
bull Check your credentials login type and file transfer mode
bull Know what backup method you expect to be used (SCP SFTP CLI TFTP FTP)
bull Manually run the sequence of backup commands first from the IMC server
bull Key log file is ltIMCgtserverconflogimccfgbakdmlog ndash tells you almost everything you need to know ndash but it takes some decoding
bull First check that the right adapter is being selected ndash look for lines like
ndash Device login type is 1dev_id=4AdaptName=CiscoASA
bull Follow log file ndash see which TCL files are being executed and what the results are
bull Check ltIMCgtservertmp for temporary session files created during execution ndash these show all the output created These are deleted on normal exit
bull Use Wireshark to inspect traffic if required
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 18
Lessons from the field
bull Copy and tweak an existing adapter if you can
bull Use unencrypted communications during development if possible ndash Wireshark can really help
bull Set timeouts to low values during debugging ndash ldquoset timeout 10rdquo
bull Keep it simple ndash start with just backups using just one method Add more later
bull Key locations
ndash Log file ltIMCgtserverconflogimccfgbakdmlog
ndash Temporary files ltIMCgtservertmp
ndash Backups ltIMCgtserverdatacfgbak
bull Pay close attention to timestamps in imccfgbakdm log file ndash these may appear out of order
bull Restart IMC and synchronize devices when first adding new adapters
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 18
Lessons from the field
bull Copy and tweak an existing adapter if you can
bull Use unencrypted communications during development if possible ndash Wireshark can really help
bull Set timeouts to low values during debugging ndash ldquoset timeout 10rdquo
bull Keep it simple ndash start with just backups using just one method Add more later
bull Key locations
ndash Log file ltIMCgtserverconflogimccfgbakdmlog
ndash Temporary files ltIMCgtservertmp
ndash Backups ltIMCgtserverdatacfgbak
bull Pay close attention to timestamps in imccfgbakdm log file ndash these may appear out of order
bull Restart IMC and synchronize devices when first adding new adapters
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Adding custom functions
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 20
XML ndash a way to define data
95 of extending iMC with new devices is done in XML
Each tag has a start and an end (ie ltStartgt ltStartgt )
Single tags can shortcut an end if no data (ie ltStart gt )
Tags can have parameters (ie ltStart time=ldquonowrdquo date=ldquotodayrdquo gt ltStartgt )
Data is within tags
ltStart time=ldquonowrdquo date=ldquotodayrdquogt
ltactiongtDo Itltactiongt
ltStartgt
Most XML files are loaded on startup Changes require service restart
Many XML files needed to define single process
bull Allows for delegationcontrol You can define the adapter and someone else can define the script actions etc
bull Easier to modify when extending a device one large XML file is cumbersome
The overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 21
Device adapters overview
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 22
Allow tier 1 2 level technicians to change allowed number of devices per port
Use case By default all access switchports are set to 1 A user just received a new VoIP phone and hooked it up between the computer and network but it will not connect
The goal
Interface - assign port security to Juniper EX switch
bull Set number of Mac-addresses learned per port
bull Assuming one desktop and one phone we will set max to 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 23
What we need to do without using iMC
The steps without IMC
Interface - assign port security to Juniper EX switch
1 Access box through SSHTelnet
2 Get into edit mode
3 ldquoset ethernet-switching-options secure-access-port interface ge-001 mac-limit 2 action droprdquo
4 commit
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 24
Identify any data that we need to collect
What are the parameters
Ask yourself ldquoWhat could changerdquo
1 ldquoset interface ge-001 mac-limit 2 action droprdquo
1 Which interface - ge-001 (string showing interface name)
2 How many to allow - 2 (any integer)
3 What to do if exceeded - drop log none shutdown
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 25
Text box
Input types
juniops_operationsxml
ltParameter name = ldquointerfaceIDrdquo label = ldquoInterfacerdquo required = ldquotruerdquogt
Interface ge-0022
Variable name = $interfaceID
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 26
Text box
Input types
juniops_operationsxml
ltParameter name = ldquomaxAllowedrdquo label=ldquoMax Allowedrdquo required = ldquotruerdquogt
Max Allowed 2
Variable name = $maxAllowed
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 27
Drop-down list
Input types
juniops_operationsxml
ltParameter name = ldquoportActionrdquo label=ldquoResulting Actionrdquo required = ldquotruerdquogt
ltView type=ldquoSelectOneMenurdquogt
ltSelectItem value=ldquodroprdquo displayValue=ldquoDrop framesrdquogt
ltSelectItem value=ldquologrdquo displayValue=ldquoLog attemptsrdquo gt
ltSelectItem value=ldquononerdquo displayValue=ldquoDo nothingrdquo gt
ltSelectItem value=ldquoshutdownrdquo displayValue=ldquoShutdown Interfacerdquo gt
ltViewgt
ltParametergt
Variable name = $portAction
Required field
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 28
The code Developing scripts
Developing TCLExpect scripts using Windows
httplinuxaboutcomodsoftortheraTcl-Expect-For-Windows-Linux-Interactionhtm
Expect user guide
httpdocsactivestatecomactivetcl85expect4winex_usagehtmlcode_tcl
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 29
Lessons from the field bull Copy and tweak an existing adapter if you can Review and use existing TCL files
bull Make sure you have valid XML files (ie terminated tags correct syntax)
bull Use unencrypted communications during development if possible ndash Wireshark can really help
ndash Use this when questioning whether the right commands are being sent
bull Key locations
ndash Log file ltIMCgtserverconflogimccmddmlog (sending commands)
ndash Log file ltIMCgtclientlogimcforegroundlog (for web interface)
ndash Custom Web UI Operations ltIMCgtclientwebappsimcgencfgregistercustom
ndash Custom scriptsadapters ltIMCgtserverconfadapterscustom
bull Pay close attention to SYSOID mappings This may answer why your device doesnrsquot display when trying to select it
bull Restart IMC when adding new adapters These get loaded on startup
bull No need to restart IMC when running scripts
bull If yoursquore stuck ask at NetOps wwwnetopscommunitynet Wersquoll do our best to help
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
eAPI code walkthrough
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 31
The business challenge
Health care bull Patient data needs to be protected
bull Medical professionals need to care for patients
bull Devices get misplaced
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 32
The technical challenge
Finding L2 addresses is a hop by hop scenario
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 33
Steps to a solution
1 Find the function in IMC
2 Find the eAPI
3 Write the code
4 Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the function
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 35
Letrsquos take a lookhellip
Using the real-time location service in IMC
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Find the eAPI
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 37
eAPI documentation
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 38
Query the IMC eAPI services
httpimc_hostportimcrsapplicationwadl
Search for ldquorealrdquo
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 39
RESTful test client
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 40
eAPI real time location output
ltxml version=10 encoding=UTF-8gt ltlistgt ltrealtimeLocationgt ltlocateIpgt00113210038bltlocateIpgt MAC to be Located ltdeviceIdgt41ltdeviceIdgt Device ID ltdeviceIpgt101010221ltdeviceIpgt Device IP ltifDescgtGigabitEthernet1021ltifDescgt Interface Label ltifIndexgt21ltifIndexgt Interface Index ltrealtimeLocationgt ltlistgt
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Write the code
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 42
Create an HTML form
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 43
Getting the information from the webpage ------------------------------------------------------------------------- Get the field VARS from the calling HTML form ------------------------------------------------------------------------- form = cgiFieldStorage() MAC = formgetvalue(macaddress) imc_url = 10132099 L = MACsplit() cr = n count = 0 Get output file ready for writing f = open(varwwwpagesmac_findtxtw) a = Mac Address b = IP Address c = Port report = s s s (abc)
Rename to columbo1py
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 44
Setup the variables Setup the URL VARS ------------------------------------------------------------------------- usernames=chewie passwords=chewie ------------------------------------------------------------------------- Write report headers ------------------------------------------------------------------------- out = ================================================================= fwrite(out) fwrite(cr) out = MAC FIND wookieware 2013 fwrite(out) fwrite(cr) out = ================================================================= fwrite(out) fwrite(cr) fwrite(report) fwrite(cr) out = ------------------------------------------------------------------ fwrite(out) fwrite(cr)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 45
Authenticate with IMC
------------------------------------------------------------------------- Define the AUTHORIZATION handler ------------------------------------------------------------------------- authhandler = urllib2HTTPDigestAuthHandler() authhandleradd_password(iMC RESTful Web Services imc_url usernames passwords) ------------------------------------------------------------------------- Authenticate with the IMC server ------------------------------------------------------------------------- opener = urllib2build_opener(authhandler) urllib2install_opener(opener)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 47
Send the eAPI string
------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() count = count + 1 mac_url=http10132099imcrsresaccessrealtimeLocatetype=1ampvalue=+MACCAD pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 48
Decode the eAPI return ------------------------------------------------------------------------- Read from memory location addinfourl assign MAC tree ------------------------------------------------------------------------- tree = xmlparse(result1) rootElement = treegetroot() Gets the root of the element In case the DevIP could have more than one return Get the first one only for node in treeiter() if (nodetag == deviceIp and DevIP == null) DevIP = nodetext DevIP for node in treeiter() if nodetag == ifDesc DevINT = nodetext line =s s s (MACCADDevIPDevINT) Write information to file fwrite(line) DevIP = null After process loop close file fclose()
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 49
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 51
Create the web page - multiple MACs
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 52
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Make it better Part 2
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 54
Create the web page ndash multiple Macshellip plus
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 55
Enhance the script
1 Obtain device IP (DevIP) and interface description (DevIF)
2 Obtain device ID in IMC database (DevID)
3 Obtain device location (DevLoc)
4 Obtain device interface (DevINT)
5 Obtain interface name (DevName)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 56
Find the MAC address ------------------------------------------------------------------------- Send eAPI string to IMC server to get MAC ------------------------------------------------------------------------- for item in L MACCAD = itemstrip() check for null value in MACCAD if MACCAD is None fclose() sysexit() count = count + 1 mac_url=httpsimcrsresaccessrealtimeLocatetype=1ampvalue=s (imc_urlMACCAD) pagehandle=urllib2Request(mac_url) pagehandleadd_header(Accept applicationxml)
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 57
Find the device location ------------------------------------------------------------------------- Now create the IP URL and collect the DevLoc ------------------------------------------------------------------------- ip_url=httpsimcrsplatresdevices (imc_urlDevID) pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result3 = urllib2urlopen(pagehandle) tree = xmlparse(result3) for node in treeiter() if nodetag == location DevLoc = nodetext for node in treeiter() if nodetag == sysName DevName = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 58
Find the interface Alias ------------------------------------------------------------------------- Create the IP URL and collect the ifAlias ------------------------------------------------------------------------- Change DevIF into interger intf = int(DevIF) - 1 ip_url=httpsimcrsplatresdevicesinterfacestart=sampsize=1 (imc_urlDevIDintf) testing pagehandle=urllib2Request(ip_url) pagehandleadd_header(Accept applicationxml) result4 = urllib2urlopen(pagehandle) tree = xmlparse(result4) for node in treeiter() if nodetag == ifAlias DevAlias = nodetext
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 59
Letrsquos take a lookhellip
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 60
For more information
Attend these sessions
bull Session Id name
bull 11 pt HP Simplified
bull Session Id name
Visit these demos
bull Demo name Demo number
bull 11 pt HP Simplified
bull Demo name Demo number
After the event
bull Visit wwwnetopscommunitynet
Your feedback is important to us Please take a few minutes to complete the session survey
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice 61
Learn more about this topic
Use HP Autonomyrsquos Augmented Reality (AR) to access more content
1 Launch the HP Autonomy AR app
2 View this slide through the app
3 Unlock additional information
Available on the App Store and Google Play
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
copy Copyright 2013 Hewlett-Packard Development Company LP The information contained herein is subject to change without notice
Thank you
top related