use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.PortBuilder in project openflowplugin by opendaylight.
the class MultipartRequestInputMessageFactory method setPortStats.
private MultipartRequestPortStatsCase setPortStats(ByteBuf input) {
MultipartRequestPortStatsCaseBuilder caseBuilder = new MultipartRequestPortStatsCaseBuilder();
MultipartRequestPortStatsBuilder portBuilder = new MultipartRequestPortStatsBuilder();
portBuilder.setPortNo(input.readUnsignedInt());
caseBuilder.setMultipartRequestPortStats(portBuilder.build());
return caseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.PortBuilder in project openflowplugin by opendaylight.
the class MatchConvertor method inPhyPortMatch.
private static void inPhyPortMatch(final List<MatchEntry> matchEntryList, NodeConnectorId inPhyPort) {
if (inPhyPort == null) {
return;
}
// TODO: currently this matchconverter is mapped to OF1.3 in MatchInjector. Will need to revisit during 1.4+
final long portNumber = InventoryDataServiceUtil.portNumberfromNodeConnectorId(OpenflowVersion.OF13, inPhyPort);
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setHasMask(false);
matchEntryBuilder.setOxmMatchField(InPhyPort.class);
InPhyPortCaseBuilder caseBuilder = new InPhyPortCaseBuilder();
InPhyPortBuilder portBuilder = new InPhyPortBuilder();
portBuilder.setPortNumber(new PortNumber(portNumber));
caseBuilder.setInPhyPort(portBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
matchEntryList.add(matchEntryBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.PortBuilder in project openflowplugin by opendaylight.
the class MatchConvertor method inPortMatch.
private static void inPortMatch(final List<MatchEntry> matchEntryList, NodeConnectorId inPort) {
if (inPort == null) {
return;
}
// TODO: currently this matchconverter is mapped to OF1.3 in MatchInjector. Will need to revisit during 1.4+
final long portNumber = InventoryDataServiceUtil.portNumberfromNodeConnectorId(OpenflowVersion.OF13, inPort);
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setHasMask(false);
matchEntryBuilder.setOxmMatchField(InPort.class);
InPortCaseBuilder caseBuilder = new InPortCaseBuilder();
InPortBuilder portBuilder = new InPortBuilder();
portBuilder.setPortNumber(new PortNumber(portNumber));
caseBuilder.setInPort(portBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
matchEntryList.add(matchEntryBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.PortBuilder in project openflowplugin by opendaylight.
the class OF10StatsRequestInputFactoryTest method testPort.
/**
* Testing OF10StatsRequestInputFactory (Port) for correct serialization.
*/
@Test
public void testPort() throws Exception {
MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
builder.setType(MultipartType.OFPMPPORTSTATS);
builder.setFlags(new MultipartRequestFlags(false));
MultipartRequestPortStatsCaseBuilder caseBuilder = new MultipartRequestPortStatsCaseBuilder();
MultipartRequestPortStatsBuilder portBuilder = new MultipartRequestPortStatsBuilder();
portBuilder.setPortNo(15L);
caseBuilder.setMultipartRequestPortStats(portBuilder.build());
builder.setMultipartRequestBody(caseBuilder.build());
MultipartRequestInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
multipartFactory.serialize(message, out);
BufferHelper.checkHeaderV10(out, (byte) 16, 20);
Assert.assertEquals("Wrong type", 4, out.readUnsignedShort());
Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
Assert.assertEquals("Wrong port-no", 15, out.readUnsignedShort());
out.skipBytes(6);
Assert.assertTrue("Unread data", out.readableBytes() == 0);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.PortBuilder in project openflowplugin by opendaylight.
the class OF10StatsRequestInputPortStatsFactoryTest method createMultipartRequestBody.
private static MultipartRequestBody createMultipartRequestBody() {
MultipartRequestPortStatsCaseBuilder caseBuilder = new MultipartRequestPortStatsCaseBuilder();
MultipartRequestPortStatsBuilder portBuilder = new MultipartRequestPortStatsBuilder();
portBuilder.setPortNo(15L);
caseBuilder.setMultipartRequestPortStats(portBuilder.build());
return caseBuilder.build();
}
Aggregations