This repository provides snmp4j https://www.snmp4j.org/ and cup http://www2.cs.tum.edu/projects/cup/ libraries, you need only 1) Install JFlex http://jflex.de/installing.html 2) make all or make all_a if you don't want to recompile Parser & Lexer This is not a example of good parsing style (error reporting is especially bad), but this is not a compiler course, and it should be enough to get you started. Note that you can achieve the same results with just StreamTokenizer or Scanner, but it is cleaner and not much longer to do it with JFlex and CUP. =============================== Some information about classes. Let's go as-is, driven by workflow in Grabber, the main class (under development). 1) Parser, Lexer, Sym -- classes, generated by Cup and JFlex, respectively. 2) Contents of .cfg file become an instance of helper class ConfigFile, which stores two List<SnmpAgent> -- one for switches, another for routers. Both could be initialized with or without credentials, v1, v2c, v3 as well. 3) We create only one connection for all requests, TransportMapping and Snmp objects, then we reuse them to retrieve all required data. 4) Instantiate Switch and Router objects from appropriate lists, invoke discover() method and print result on standart output. 5) Switch contains a field for Vlans, which are simple data structure, used to represent grabbed data. The same about classes Iface and Route, when Router is asked about interfaces and routes. Also there are helper classes: SnmpConstants, Utils ==================================== What's already done: - 2.1 (Routers) - 2.2 (Switches) TODO: - Resolve DNS - 2.3 (Subnets) - Report ======================================= Usage: 1) make all Compiles all and runs Parser, i.e. you'll see basic representation of parsed config file. 2) export MYCLASSPATH=out/production/snmp-parsing:/opt/snmp4j-2.4.3/dist/snmp4j-2.4.3.jar:/usr/share/java/cup.jar java -cp $MYCLASSPATH src.Grabber lab.cfg It will run main program, which is parsing config and invokes discovery for every SnmpAgent instance.