Hi community,
While reading the programming guide (2.7) I found the example 12 (page 142) which show how to use handler facets to obtain information about VLAN. I have a couple of questions about that code:
private Set<VlanInfo> getVlans(DeviceService ds, DeviceDriverService dds, DataPathId dpid) { Set<VlanInfo> vlans = new HashSet<VlanInfo>(); try { // get the device object that has data path id (dpid) Device dev = ds.getDevice(dpid); // get the DeviceInfo object DeviceInfo di = dev.info(); // create a Device Handler DeviceHandler dh = dds.create(di, getIp(di)); // check if the Handler Facet is available for the device if (dh.isSupported(VlanHandler.class)) { // use the Device Handler to get the Handler Facet VlanHandler hf = dh.getFacet(VlanHandler.class); // the guide says VlanHanlderFacet.class // use the Handler Facet to get vlan information vlans = hf.getVlans(); log.info("The VLANS: {} \n{} " + dpid + (vlans.toString())); } } catch (Exception e) { e.printStackTrace(); } return vlans; } /** * Returns the IP address associated with the DeviceInfo object. * * @param di DeviceInfo object * @return IP address for the DeviceInfo object */ private IpAddress getIp(DeviceInfo di) { DeviceIdentity facet = di.getFacet(com.hp.device.DeviceIdentity.class); return facet.getIpAddress(); }
- The "VlanHandlerFacet.class" in the manual does not exist. I assume is a typo and it actually refers to VlanHandler.class (as I did above).
- After I added this code to my application I am no longer able to compile the module. In particular, here's the output after I run mvn clean install:
..... [INFO] ------------------------------------------------------------------------ [INFO] Building topo-bl 1.0.0 [INFO] ------------------------------------------------------------------------ [WARNING] The POM for org.eclipse.persistence:eclipselink:jar:2.3.2 is invalid, transitive dependencies
The error is quite clear and basically tells that it cannot find the com.tailf:jnc:1.03 dependency. Well, it turns out that that particular version does not exist in the internet at all AFAIK. I looked online and found a lot of similar JNC (stands for Java NETCONF client) jars provided mainly by onlab but with different versions, there's no 1.0.3 and non with groupid com.tailf. Even if I specify the version in the pom.xml file it is still asking for 1.0.3. I wonder if I am missing something here.
(if any) will not be available, enable debug logging for more details [WARNING] The POM for com.tailf:jnc:jar:1.0.3 is missing, no dependency information available [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] topo-root .......................................... SUCCESS [ 0.401 s] [INFO] topo-model ......................................... SUCCESS [ 1.670 s] [INFO] topo-api ........................................... SUCCESS [ 0.639 s] [INFO] topo-bl ............................................ FAILURE [ 0.036 s] [INFO] topo-rs ............................................ SKIPPED [INFO] topo-app ........................................... SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.338 s [INFO] Finished at: 2017-10-18T20:08:08-04:00 [INFO] Final Memory: 27M/239M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project topo-bl: Could not resolve dependencies
for project com.uky.topo:topo-bl:bundle:1.0.0: Failure to find
com.tailf:jnc:jar:1.0.3 in https://repo.maven.apache.org/maven2 was cached in
the local repository, resolution will not be reattempted until the update
interval of central has elapsed or updates are forced -> [Help 1] [ERROR] - Is this the way to obtain information about VLANs from the switches? I know our switches accept SNMP queries. But I want to make sure what's the right way to obtain this information.
Any help will be greatly appreciated!