本文整理汇总了Java中org.onosproject.net.Device.Type方法的典型用法代码示例。如果您正苦于以下问题:Java Device.Type方法的具体用法?Java Device.Type怎么用?Java Device.Type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.net.Device
的用法示例。
在下文中一共展示了Device.Type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: routerAdded
import org.onosproject.net.Device; //导入方法依赖的package包/类
@Override
public void routerAdded(IsisRouter isisRouter) {
String systemId = isisRouter.systemId();
log.info("Added device {}", systemId);
DeviceId deviceId = DeviceId.deviceId(IsisRouterId.uri(systemId));
Device.Type deviceType = Device.Type.ROUTER;
//If our routerType is Dr or Bdr type is PSEUDO
if (isisRouter.isDis()) {
deviceType = Device.Type.ROUTER;
} else {
deviceType = Device.Type.VIRTUAL;
}
ChassisId cId = new ChassisId();
DefaultAnnotations.Builder newBuilder = DefaultAnnotations.builder();
newBuilder.set(AnnotationKeys.TYPE, "L3");
newBuilder.set("RouterId", systemId);
DeviceDescription description =
new DefaultDeviceDescription(IsisRouterId.uri(systemId), deviceType, UNKNOWN, UNKNOWN, UNKNOWN,
UNKNOWN, cId, newBuilder.build());
deviceProviderService.deviceConnected(deviceId, description);
System.out.println("Device added: " + systemId);
}
示例2: updateDeviceTypeRule
import org.onosproject.net.Device; //导入方法依赖的package包/类
@Test
public void updateDeviceTypeRule() {
Device.Type deviceType1 = Device.Type.ROADM;
Device.Type deviceType2 = Device.Type.SWITCH;
Set<Device.Type> deviceTypes = new HashSet<>();
deviceTypes.add(deviceType1);
cfg.deviceTypes(deviceTypes);
configEvent(NetworkConfigEvent.Type.CONFIG_ADDED);
deviceTypes.add(deviceType2);
cfg.deviceTypes(deviceTypes);
configEvent(NetworkConfigEvent.Type.CONFIG_UPDATED);
assertAfter(EVENT_MS, () -> {
assertTrue(provider.rules().getSuppressedDeviceType().contains(deviceType1));
assertTrue(provider.rules().getSuppressedDeviceType().contains(deviceType2));
});
}
示例3: deviceType
import org.onosproject.net.Device; //导入方法依赖的package包/类
@Override
public Device.Type deviceType() {
String hwDesc = hardwareDescription();
switch (hwDesc) {
case "Optical-ROADM":
return Device.Type.ROADM;
case "Optical-OTN":
return Device.Type.OTN;
default:
log.error("Unsupported hardwareDescription {}", hwDesc);
return Device.Type.OTHER;
}
}
示例4: switchAdded
import org.onosproject.net.Device; //导入方法依赖的package包/类
@Override
public void switchAdded(PcepDpid dpid) {
if (deviceProviderService == null) {
return;
}
DeviceId deviceId = deviceId(uri(dpid));
PcepSwitch sw = controller.getSwitch(dpid);
checkNotNull(sw, "device should not null.");
// The default device type is switch.
ChassisId cId = new ChassisId(dpid.value());
Device.Type deviceType;
switch (sw.getDeviceType()) {
case ROADM:
deviceType = Device.Type.ROADM;
break;
case OTN:
deviceType = Device.Type.SWITCH;
break;
case ROUTER:
deviceType = Device.Type.ROUTER;
break;
default:
deviceType = Device.Type.OTHER;
}
DeviceDescription description = new DefaultDeviceDescription(
deviceId.uri(),
deviceType,
sw.manufacturerDescription(),
sw.hardwareDescription(),
sw.softwareDescription(),
sw.serialNumber(),
cId);
deviceProviderService.deviceConnected(deviceId, description);
}
示例5: isCrossConnectLink
import org.onosproject.net.Device; //导入方法依赖的package包/类
/**
* Verifies if given link forms a cross-connection between packet and optical layer.
*
* @param link the link
* @return true if the link is a cross-connect link, false otherwise
*/
private boolean isCrossConnectLink(Link link) {
if (link.type() != Link.Type.OPTICAL) {
return false;
}
Device.Type src = deviceService.getDevice(link.src().deviceId()).type();
Device.Type dst = deviceService.getDevice(link.dst().deviceId()).type();
return src != dst &&
((isPacketLayer(src) && isTransportLayer(dst)) || (isPacketLayer(dst) && isTransportLayer(src)));
}
示例6: addDeviceTypeRule
import org.onosproject.net.Device; //导入方法依赖的package包/类
@Test
public void addDeviceTypeRule() {
Device.Type deviceType1 = Device.Type.ROADM;
Device.Type deviceType2 = Device.Type.SWITCH;
Set<Device.Type> deviceTypes = new HashSet<>();
deviceTypes.add(deviceType1);
cfg.deviceTypes(deviceTypes);
configEvent(NetworkConfigEvent.Type.CONFIG_ADDED);
assertTrue(provider.rules().getSuppressedDeviceType().contains(deviceType1));
assertFalse(provider.rules().getSuppressedDeviceType().contains(deviceType2));
}
示例7: deviceType
import org.onosproject.net.Device; //导入方法依赖的package包/类
@Override
public Device.Type deviceType() {
return Device.Type.ROADM;
}
示例8: deviceType
import org.onosproject.net.Device; //导入方法依赖的package包/类
@Override
public Device.Type deviceType() {
return Device.Type.FIBER_SWITCH;
}
示例9: deviceType
import org.onosproject.net.Device; //导入方法依赖的package包/类
@Override
public Device.Type deviceType() {
return Device.Type.SWITCH;
}
示例10: getSuppressedDeviceType
import org.onosproject.net.Device; //导入方法依赖的package包/类
Set<Device.Type> getSuppressedDeviceType() {
return suppressedDeviceType;
}
示例11: deviceTypes
import org.onosproject.net.Device; //导入方法依赖的package包/类
@Override
public Set<Device.Type> deviceTypes() {
return ImmutableSet.copyOf(deviceTypes);
}
示例12: type
import org.onosproject.net.Device; //导入方法依赖的package包/类
/**
* Returns the device type.
*
* @return device type override
*/
public Device.Type type() {
return get(TYPE, Device.Type.SWITCH, Device.Type.class);
}
示例13: isTransportLayer
import org.onosproject.net.Device; //导入方法依赖的package包/类
/**
* Verifies if given device type is in packet layer, i.e., switch or router device.
*
* @param type device type
* @return true if in packet layer, false otherwise
*/
private boolean isTransportLayer(Device.Type type) {
return type == Device.Type.ROADM || type == Device.Type.OTN || type == Device.Type.ROADM_OTN;
}
示例14: deviceType
import org.onosproject.net.Device; //导入方法依赖的package包/类
/**
* Returns the switch device type.
*
* @return device type
*/
Device.Type deviceType();
示例15: getDevices
import org.onosproject.net.Device; //导入方法依赖的package包/类
/**
* Returns a collection of the currently known infrastructure
* devices by device type.
*
* @param type device type
* @return collection of devices
*/
Iterable<Device> getDevices(Device.Type type);