use of org.onosproject.net.device.PortDescription in project onos by opennetworkinglab.
the class DellRestPortDiscovery method getPorts.
@Deprecated
public List<PortDescription> getPorts() {
List<PortDescription> ports = Lists.newArrayList();
DriverHandler handler = handler();
RestSBController controller = checkNotNull(handler.get(RestSBController.class));
DeviceId deviceId = handler.data().deviceId();
String remotePortName = "";
// read configuration from REST API
HierarchicalConfiguration config = XmlConfigParser.loadXml(controller.get(deviceId, INTERFACES_REQUEST, MediaType.valueOf("*/*")));
// get the interfaces part
List<HierarchicalConfiguration> portsConfig = parseDellPorts(config);
portsConfig.stream().forEach(sub -> {
String portName = sub.getString(NAME);
DefaultAnnotations.Builder annotations = DefaultAnnotations.builder().set(AnnotationKeys.PORT_NAME, portName);
// TODO: obtain proper port speed and type
long portSpeed = 10_000;
Port.Type portType = Port.Type.COPPER;
PortNumber portNumber = PortNumber.fromString(remotePortName.replaceAll(TENGINTERFACENAME, ""));
ports.add(DefaultPortDescription.builder().withPortNumber(portNumber).isEnabled(true).type(portType).portSpeed(portSpeed).annotations(annotations.build()).build());
});
return ImmutableList.copyOf(ports);
}
Aggregations