================================== netdev - CLI search for NetDevices ================================== .. contents:: :local: :depth: 2 About ===== **netdev** is a command-line search interface for :class:`~trigger.netdevices.NetDevices` metadata. Usage ===== Here is the usage output:: % netdev Usage: netdev [options] Command-line search interface for 'netdevices.xml'. Options: -h, --help show this help message and exit -a, --acls Search will return acls instead of devices. -l , --list= List all information for individual DEVICE -s, --search Perform a search based on matching criteria -L , --location= For use with -s: Match on site location. -n , --nodename= For use with -s: Match on full or partial nodeName. NO REGEXP. -t , --type= For use with -s: Match on deviceType. Must be FIREWALL, ROUTER, or SWITCH. -o , --owning-team= For use with -s: Match on Owning Team (owningTeam). -O , --oncall-team= For use with -s: Match on Oncall Team (onCallName). -C , --owning-org= For use with -s: Match on cost center Owning Org. (owner). -m , --manufacturer= For use with -s: Match on manufacturer. -b , --budget-code= For use with -s: Match on budget code -B , --budget-name= For use with -s: Match on budget name -k , --make= For use with -s: Match on make. -M , --model= For use with -s: Match on model. -N, --nonprod Look for production and non-production devices. Examples ======== Displaying an individual device ------------------------------- You may use the ``-l`` option to list an individual device:: % netdev -l test1-abc Hostname: test1-abc.net.aol.com Owning Org.: 12345678 - Network Engineering Owning Team: Data Center OnCall Team: Data Center Manufacturer: JUNIPER Make: M40 INTERNET BACKBONE ROUTER Model: M40-B-AC Type: ROUTER Location: LAB CR10 16ZZ Project: Test Lab Serial: 987654321 Asset Tag: 0000012345 Budget Code: 1234578 (Data Center) Admin Status: PRODUCTION Lifecycle Status: INSTALLED Operation Status: MONITORED Last Updated: 2010-07-19 19:56:32.0 Partial names are also ok:: % netdev -l test1 3 possible matches found for 'test1': [ 1] test1-abc.net.aol.com [ 2] test1-def.net.aol.com [ 3] test1-xyz.net.aol.com [ 0] Exit Enter a device number: Searching by metadata --------------------- To search you must specify the ``-s`` flag. All subsequent options are used as search terms. Each of the supported options coincides with attributes found on :class:`~trigger.netdevices.NetDevice` objects. You must provide at least one optional field or this happens:: % netdev -s netdev: error: -s needs at least one other option, excluding -l. Search for all Juniper switches in site "BBQ":: % netdev -s -t switch -m juniper -L bbq All search arguments accept partial matches and are case-INsensitive, so this:: % netdev -s --manufacturer='CISCO SYSTEMS' --location=BBQ Is equivalent to this:: % netdev -s --manufacturer=cisco --location=bbq You can't mix ``-l`` (list) and ``-s`` (search) because they contradict each other:: % netdev -s -l -n test1 Usage: netdev [options] netdev: error: -l and -s cannot be used together