@Override public List<? extends OFObject> getPortsOf(PortDescPropertyType type) { if (!type.equals(PortDescPropertyType.OPTICAL_TRANSPORT)) { return Collections.EMPTY_LIST; } return opticalPorts; }
/** * Find oplink port description type from optical ports. * * @param opsw switch * @param portNum the port number * @return port oplink port description type */ private PortDescType getPortDescType(OpenFlowOpticalSwitch opsw, PortNumber portNum) { for (PortDescPropertyType type : opsw.getPortTypes()) { List<? extends OFObject> portsOf = opsw.getPortsOf(type); for (OFObject op : portsOf) { if (op instanceof OFPortOptical) { OFPortOptical opticalPort = (OFPortOptical) op; if ((long) opticalPort.getPortNo().getPortNumber() == portNum.toLong()) { return PortDescType.values()[opticalPort.getDesc().get(0).getPortType()]; } } } } return PortDescType.NONE; }
@Override public List<? extends OFObject> getPortsOf(PortDescPropertyType type) { // Expected type is OPTICAL_TRANSPORT if (type == PortDescPropertyType.OPTICAL_TRANSPORT) { return ImmutableList.copyOf(opticalPorts); } // Any other type, return empty log.warn("Unexpected port description property type: {}", type); return ImmutableList.of(); }
@Override public List<? extends OFObject> getPortsOf(PortDescPropertyType type) { if (!type.equals(PortDescPropertyType.OPTICAL_TRANSPORT)) { return ImmutableList.of(); } return opticalPorts; }
private PortDescription buildPortDescription(PortDescPropertyType ptype, OFObject port, OpenFlowOpticalSwitch opsw) { if (port instanceof OFPortOptical) { return buildPortDescription(ptype, (OFPortOptical) port, opsw); } return buildPortDescription(ptype, (OFExpPort) port); }
@Override public List<? extends OFObject> getPortsOf(PortDescPropertyType type) { return ImmutableList.copyOf(expPortDes); }
@Override public List<? extends OFObject> getPortsOf(PortDescPropertyType type) { return ImmutableList.copyOf(opticalPorts); }
@Override public List<? extends OFObject> getPortsOf(PortDescPropertyType type) { return ImmutableList.copyOf(fiberPorts); }
private PortDescription buildPortDescription(PortDescPropertyType ptype, OFObject port) { if (port instanceof OFPortOptical) { return buildPortDescription(ptype, (OFPortOptical) port); } return buildPortDescription(ptype, (OFExpPort) port); }
/** * Return a list of interfaces (ports) of the type associated with this * OpenFlow switch. * * @param type The port description property type of requested ports * @return A potentially empty list of ports. */ List<? extends OFObject> getPortsOf(PortDescPropertyType type);
/** * @param obj OpenFlow object to test * @return true if OFObject is OF_13 or later */ private static boolean isOF13OrLater(OFObject obj) { return obj.getVersion().wireVersion >= OFVersion.OF_13.wireVersion; }