use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder in project genius by opendaylight.
the class InterfaceManagerTestUtil method buildFlowCapableNodeConnector.
static FlowCapableNodeConnector buildFlowCapableNodeConnector(boolean isPortDown, boolean isLive, String macAddress, String portName) {
PortConfig portConfig = new PortConfig(false, false, false, isPortDown);
State state = new StateBuilder().setBlocked(true).setLinkDown(false).setLive(isLive).build();
FlowCapableNodeConnectorBuilder fcNodeConnector = new FlowCapableNodeConnectorBuilder().setName(portName).setHardwareAddress(MacAddress.getDefaultInstance(macAddress)).setConfiguration(portConfig).setState(state);
return fcNodeConnector.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder in project openflowplugin by opendaylight.
the class NodeConnectorInventoryEventTranslator method processUpdatedConnector.
private void processUpdatedConnector(final DataTreeModification<T> modification) {
final InstanceIdentifier<T> identifier = modification.getRootPath().getRootIdentifier();
InstanceIdentifier<NodeConnector> nodeConnectorInstanceId = identifier.firstIdentifierOf(NodeConnector.class);
if (compareIITail(identifier, II_TO_FLOW_CAPABLE_NODE_CONNECTOR)) {
FlowCapableNodeConnector flowConnector = (FlowCapableNodeConnector) modification.getRootNode().getDataAfter();
if (isPortDown(flowConnector)) {
notifyNodeConnectorDisappeared(nodeConnectorInstanceId);
} else {
notifyNodeConnectorAppeared(nodeConnectorInstanceId, flowConnector);
}
} else if (compareIITail(identifier, II_TO_STATE)) {
FlowCapableNodeConnector flowNodeConnector = iiToDownFlowCapableNodeConnectors.get(nodeConnectorInstanceId);
if (flowNodeConnector != null) {
State state = (State) modification.getRootNode().getDataAfter();
if (!state.isLinkDown()) {
FlowCapableNodeConnectorBuilder flowCapableNodeConnectorBuilder = new FlowCapableNodeConnectorBuilder(flowNodeConnector);
flowCapableNodeConnectorBuilder.setState(state);
notifyNodeConnectorAppeared(nodeConnectorInstanceId, flowCapableNodeConnectorBuilder.build());
iiToDownFlowCapableNodeConnectors.remove(nodeConnectorInstanceId);
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder in project openflowplugin by opendaylight.
the class PortDescMultipartWriter method storeStatistics.
@Override
public void storeStatistics(final MultipartReplyPortDesc statistics, final boolean withParents) {
statistics.getPorts().forEach(stat -> {
final NodeConnectorId id = InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(features.getDatapathId(), OpenflowPortsUtil.getProtocolPortNumber(OpenflowVersion.get(features.getVersion()), stat.getPortNumber()), OpenflowVersion.get(features.getVersion()));
writeToTransaction(getInstanceIdentifier().child(NodeConnector.class, new NodeConnectorKey(id)), new NodeConnectorBuilder().setId(id).addAugmentation(FlowCapableNodeConnector.class, new FlowCapableNodeConnectorBuilder(stat).build()).addAugmentation(FlowCapableNodeConnectorStatisticsData.class, new FlowCapableNodeConnectorStatisticsDataBuilder().build()).build(), withParents);
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder in project openflowplugin by opendaylight.
the class PortUpdateTranslator method translate.
@Override
public FlowCapableNodeConnector translate(final PortGrouping input, final DeviceInfo deviceInfo, final Object connectionDistinguisher) {
final FlowCapableNodeConnectorBuilder builder = new FlowCapableNodeConnectorBuilder();
// OF1.0
if (deviceInfo.getVersion() == OFConstants.OFP_VERSION_1_0) {
builder.setAdvertisedFeatures(PortTranslatorUtil.translatePortFeatures(input.getAdvertisedFeaturesV10()));
builder.setConfiguration(PortTranslatorUtil.translatePortConfig(input.getConfigV10()));
builder.setCurrentFeature(PortTranslatorUtil.translatePortFeatures(input.getCurrentFeaturesV10()));
builder.setPeerFeatures(PortTranslatorUtil.translatePortFeatures(input.getPeerFeaturesV10()));
builder.setState(PortTranslatorUtil.translatePortState(input.getStateV10()));
builder.setSupported(PortTranslatorUtil.translatePortFeatures(input.getSupportedFeaturesV10()));
} else if (deviceInfo.getVersion() == OFConstants.OFP_VERSION_1_3) {
builder.setAdvertisedFeatures(PortTranslatorUtil.translatePortFeatures(input.getAdvertisedFeatures()));
builder.setConfiguration(PortTranslatorUtil.translatePortConfig(input.getConfig()));
builder.setCurrentFeature(PortTranslatorUtil.translatePortFeatures(input.getCurrentFeatures()));
builder.setPeerFeatures(PortTranslatorUtil.translatePortFeatures(input.getPeerFeatures()));
builder.setState(PortTranslatorUtil.translatePortState(input.getState()));
builder.setSupported(PortTranslatorUtil.translatePortFeatures(input.getSupportedFeatures()));
builder.setQueue(Collections.<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue>emptyList());
}
if (input instanceof PortStatusMessage) {
if (((PortStatusMessage) input).getReason() != null) {
builder.setReason(PortReason.forValue(((PortStatusMessage) input).getReason().getIntValue()));
} else {
LOG.debug("PortStatus Message has reason as null");
}
}
builder.setCurrentSpeed(input.getCurrSpeed());
builder.setHardwareAddress(input.getHwAddr());
builder.setMaximumSpeed(input.getMaxSpeed());
builder.setName(input.getName());
builder.setPortNumber(new PortNumberUni(input.getPortNo()));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder in project openflowplugin by opendaylight.
the class DataTreeChangeListenerBase method provideFlowCapableNodeConnector.
protected FlowCapableNodeConnector provideFlowCapableNodeConnector(final boolean isLinkDown, final boolean isPortDown) {
FlowCapableNodeConnectorBuilder builder = new FlowCapableNodeConnectorBuilder();
builder.setState(new StateBuilder().setLinkDown(isLinkDown).build());
builder.setConfiguration(new PortConfig(true, true, true, isPortDown));
return builder.build();
}
Aggregations