本文整理汇总了Java中org.onosproject.net.Port.Type方法的典型用法代码示例。如果您正苦于以下问题:Java Port.Type方法的具体用法?Java Port.Type怎么用?Java Port.Type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.net.Port
的用法示例。
在下文中一共展示了Port.Type方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: translate
import org.onosproject.net.Port; //导入方法依赖的package包/类
/**
* Translates gRPC PortType to {@link Port.Type}.
*
* @param type gRPC message
* @return {@link Port.Type}
*/
public static Port.Type translate(PortType type) {
switch (type) {
case COPPER:
return Type.COPPER;
case FIBER:
return Type.FIBER;
case OCH:
return Type.OCH;
case ODUCLT:
return Type.ODUCLT;
case OMS:
return Type.OMS;
case PACKET:
return Type.PACKET;
case VIRTUAL:
return Type.VIRTUAL;
case UNRECOGNIZED:
default:
log.warn("Unexpected PortType: {}", type);
return Type.COPPER;
}
}
示例2: buildPortDescription
import org.onosproject.net.Port; //导入方法依赖的package包/类
/**
* Build a portDescription from a given Ethernet port description.
*
* @param port the port to build from.
* @return portDescription for the port.
*/
private PortDescription buildPortDescription(OFPortDesc port) {
PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber());
boolean enabled =
!port.getState().contains(OFPortState.LINK_DOWN) &&
!port.getConfig().contains(OFPortConfig.PORT_DOWN);
Port.Type type = port.getCurr().contains(OFPortFeatures.PF_FIBER) ? FIBER : COPPER;
SparseAnnotations annotations = makePortAnnotation(port.getName(), port.getHwAddr().toString());
return new DefaultPortDescription(portNo, enabled, type,
portSpeed(port), annotations);
}
示例3: read
import org.onosproject.net.Port; //导入方法依赖的package包/类
@Override
public DefaultPort read(Kryo kryo, Input input, Class<DefaultPort> aClass) {
Element element = (Element) kryo.readClassAndObject(input);
PortNumber number = kryo.readObject(input, PortNumber.class);
boolean isEnabled = input.readBoolean();
Port.Type type = kryo.readObject(input, Port.Type.class);
long portSpeed = input.readLong();
Annotations annotations = (Annotations) kryo.readClassAndObject(input);
return new DefaultPort(element, number, isEnabled, type, portSpeed, annotations);
}
示例4: type
import org.onosproject.net.Port; //导入方法依赖的package包/类
@Override
public Port.Type type() {
return delegate.type();
}
示例5: portType
import org.onosproject.net.Port; //导入方法依赖的package包/类
/**
* Sets the port type, or updates it if it's already set. A null argument removes
* this field.
*
* @param type the port type
* @return this OpticalPortConfig instance
*/
public OpticalPortConfig portType(Port.Type type) {
// if unspecified, ideally fall back on FIBER or PACKET.
String pt = (type == null) ? null : type.toString();
return (OpticalPortConfig) setOrClear(TYPE, pt);
}