use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.multipart.reply.port.desc.Ports in project bgpcep by opendaylight.
the class FSPortHandler method parsePort.
private static List<Ports> parsePort(final ByteBuf nlri) {
final List<Ports> ports = new ArrayList<>();
boolean end = false;
// we can do this as all fields will be rewritten in the cycle
final PortsBuilder builder = new PortsBuilder();
while (!end) {
final byte b = nlri.readByte();
final NumericOperand op = NumericOneByteOperandParser.INSTANCE.parse(b);
builder.setOp(op);
final short length = AbstractOperandParser.parseLength(b);
builder.setValue(ByteArray.bytesToInt(ByteArray.readBytes(nlri, length)));
end = op.isEndOfList();
ports.add(builder.build());
}
return ports;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.multipart.reply.port.desc.Ports in project openflowplugin by opendaylight.
the class LLDPSpeaker method run.
/**
* Send LLDPDU frames to all known openflow switch ports.
*/
@Override
public void run() {
if (OperStatus.RUN.equals(operationalStatus)) {
LOG.debug("Sending LLDP frames to nodes {}", Arrays.toString(deviceOwnershipStatusService.getOwnedNodes().toArray()));
LOG.debug("Sending LLDP frames to total {} ports", getOwnedPorts());
nodeConnectorMap.keySet().forEach(ncIID -> {
NodeConnectorId nodeConnectorId = InstanceIdentifier.keyOf(ncIID).getId();
NodeId nodeId = ncIID.firstKeyOf(Node.class, NodeKey.class).getId();
if (deviceOwnershipStatusService.isEntityOwned(nodeId.getValue())) {
LOG.debug("Node is owned by this controller, sending LLDP packet through port {}", nodeConnectorId.getValue());
packetProcessingService.transmitPacket(nodeConnectorMap.get(ncIID));
} else {
LOG.trace("Node {} is not owned by this controller, so skip sending LLDP packet on port {}", nodeId.getValue(), nodeConnectorId.getValue());
}
});
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.multipart.reply.port.desc.Ports in project openflowplugin by opendaylight.
the class OpenflowpluginStatsTestCommandProvider method _portDescStats.
public void _portDescStats(CommandInterpreter ci) {
int nodeConnectorCount = 0;
int nodeConnectorDescStatsCount = 0;
List<Node> nodes = getNodes();
for (Node node2 : nodes) {
NodeKey nodeKey = node2.getKey();
InstanceIdentifier<Node> nodeRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey);
ReadOnlyTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
Node node = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, nodeRef);
if (node != null) {
if (node.getNodeConnector() != null) {
List<NodeConnector> ports = node.getNodeConnector();
for (NodeConnector nodeConnector2 : ports) {
nodeConnectorCount++;
NodeConnectorKey nodeConnectorKey = nodeConnector2.getKey();
InstanceIdentifier<FlowCapableNodeConnector> connectorRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey).child(NodeConnector.class, nodeConnectorKey).augmentation(FlowCapableNodeConnector.class);
FlowCapableNodeConnector nodeConnector = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, connectorRef);
if (nodeConnector != null) {
if (null != nodeConnector.getName() && null != nodeConnector.getCurrentFeature() && null != nodeConnector.getState() && null != nodeConnector.getHardwareAddress() && null != nodeConnector.getPortNumber()) {
nodeConnectorDescStatsCount++;
}
}
}
}
}
}
if (nodeConnectorCount == nodeConnectorDescStatsCount) {
LOG.debug("portDescStats - Success");
} else {
LOG.debug("portDescStats - Failed");
LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.multipart.reply.port.desc.Ports in project openflowplugin by opendaylight.
the class SalPortServiceImplTest method dummyUpdatePortInput.
private UpdatePortInput dummyUpdatePortInput() {
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortBuilder concretePortBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortBuilder();
concretePortBuilder.setConfiguration(new PortConfig(true, true, true, true));
concretePortBuilder.setAdvertisedFeatures(new PortFeatures(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true));
concretePortBuilder.setPortNumber(new PortNumberUni(DUMMY_PORT_NUMBER));
concretePortBuilder.setHardwareAddress(new MacAddress(DUMMY_MAC_ADDRESS));
List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port> ports = Lists.newArrayList(concretePortBuilder.build());
Port port = new PortBuilder().setPort(ports).build();
UpdatedPort updatePort = new UpdatedPortBuilder().setPort(port).build();
return new UpdatePortInputBuilder().setUpdatedPort(updatePort).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.multipart.reply.port.desc.Ports in project openflowplugin by opendaylight.
the class OF10FeaturesReplyMessageFactory method deserialize.
@Override
public GetFeaturesOutput deserialize(final ByteBuf rawMessage) {
GetFeaturesOutputBuilder builder = new GetFeaturesOutputBuilder();
builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
builder.setXid(rawMessage.readUnsignedInt());
byte[] datapathId = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
rawMessage.readBytes(datapathId);
builder.setDatapathId(new BigInteger(1, datapathId));
builder.setBuffers(rawMessage.readUnsignedInt());
builder.setTables(rawMessage.readUnsignedByte());
rawMessage.skipBytes(PADDING_IN_FEATURES_REPLY_HEADER);
builder.setCapabilitiesV10(createCapabilitiesV10(rawMessage.readUnsignedInt()));
builder.setActionsV10(createActionsV10(rawMessage.readUnsignedInt()));
List<PhyPort> ports = new ArrayList<>();
while (rawMessage.readableBytes() > 0) {
ports.add(deserializePort(rawMessage));
}
builder.setPhyPort(ports);
return builder.build();
}
Aggregations