Java 类org.projectfloodlight.openflow.protocol.OFPortDescProp 实例源码

项目:onos    文件:OpenFlowPowerConfig.java   
@Override
public Optional<Range<Long>> getTargetPowerRange(PortNumber port, T component) {
    for (OFPortDesc pd : getPortDescs()) {
        if (pd.getPortNo().getPortNumber() == port.toLong()) {
            for (OFPortDescProp prop : pd.getProperties()) {
                if (prop instanceof OFPortDescPropOptical) {
                    OFPortDescPropOptical oprop = (OFPortDescPropOptical) prop;
                    long txMin = oprop.getTxPwrMin();
                    long txMax = oprop.getTxPwrMax();
                    return Optional.of(Range.closed(txMin, txMax));
                }
            }
        }
    }
    return Optional.empty();
}
项目:onos    文件:OpenFlowPowerConfig.java   
@Override
public List<PortNumber> getPorts(T component) {
    List<PortNumber> ports = new ArrayList<>();
    for (OFPortDesc pd : getPortDescs()) {
        for (OFPortDescProp prop : pd.getProperties()) {
            // Note: Power monitor detection can actually be more complex
            // than this. It is possible that the power is not
            // configurable, but it is readable. In this case, the best
            // bet is probably to check rx/tx power info valid in the
            // port stats reply, unfortunately.
            if (prop instanceof OFPortDescPropOptical) {
                ports.add(PortNumber.portNumber(pd.getPortNo().getPortNumber()));
                break;
            }
        }
    }
    return ports;
}
项目:loxigen-artifacts    文件:OFPortDescTest.java   
@Test
public void testGenerationIdSet() {
    OFFactory factory = OFFactories.getFactory(OFVersion.OF_14);
    OFPortDesc desc = factory.buildPortDesc()
      .setProperties(ImmutableList.<OFPortDescProp>of(
              factory.portDescPropBsnGenerationId(U64.of(1234))))
      .build();

   assertThat(desc.getBsnGenerationId(), equalTo(U64.of(1234)));
}