- Community Home
- >
- Networking
- >
- Software Defined Networking
- >
- How to use HandlerFacet to get VLAN information
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2017 05:20 PM - edited 10-18-2017 05:21 PM
10-18-2017 05:20 PM - edited 10-18-2017 05:21 PM
How to use HandlerFacet to get VLAN information
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2017 06:45 PM
10-24-2017 06:45 PM
Re: How to use HandlerFacet to get VLAN information
Hi checho,
On point #1, you're correct that it should be VlanHandler.class, and not VlanHandlerFacet.class. Specifically, the fully-qualified class should be:
com.hp.sdn.dvc.facet.VlanHandler.class
On point #2, I see that HPE Aruba implementations for com.hp.sdn.dvc.facet.impl.NetconfClient (a helper class) and com.hp.sdn.dvc.facet.impl.Vxlan5930 (a VxlanFacet implementation for 5930) both import com.tailf.jnc.* classes. I believe you're getting the error because your code imports the device driver code (sdn-ctl-dd), which pulls in all other drivers in the module (including NetconfClient,Vxlan5930) and their dependencies (com.tailf.jnc.*). Looking at the source for com.tailf.jnc on github (link here), I don't see it being modified in the past 2-3 years so I think any version would suffice. Unfortunately, I'm not skilled enough to figure out how to trick your maven repository into thinking whatever version you downloaded is the version 1.0.3 that it's looking for. Maybe someone else could help here?
You're using the correct method for getting VLAN information from the switches. Our design/architecture funnels all device-specific requests through 'facets' so that device queries can use drivers without the caller knowing specifically which driver is being used (a pluggable architecture).
Shaun