本文整理汇总了Java中org.onosproject.vtnrsc.FloatingIp.Status.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java Status.valueOf方法的具体用法?Java Status.valueOf怎么用?Java Status.valueOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.vtnrsc.FloatingIp.Status
的用法示例。
在下文中一共展示了Status.valueOf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.onosproject.vtnrsc.FloatingIp.Status; //导入方法依赖的package包/类
@Override
protected void execute() {
FloatingIpService service = get(FloatingIpService.class);
try {
FloatingIp floatingIpObj = new DefaultFloatingIp(
FloatingIpId.of(id),
TenantId.tenantId(tenantId),
TenantNetworkId.networkId(networkId),
VirtualPortId.portId(portId),
RouterId.valueOf(routerId),
floatingIp == null ? null : IpAddress.valueOf(floatingIp),
fixedIp == null ? null : IpAddress.valueOf(fixedIp),
status == null ? Status.ACTIVE
: Status.valueOf(status));
Set<FloatingIp> floatingIpSet = Sets.newHashSet(floatingIpObj);
service.createFloatingIps(floatingIpSet);
} catch (Exception e) {
print(null, e.getMessage());
}
}
示例2: execute
import org.onosproject.vtnrsc.FloatingIp.Status; //导入方法依赖的package包/类
@Override
protected void execute() {
FloatingIpService service = get(FloatingIpService.class);
FloatingIpId floatingIpId = FloatingIpId.of(id);
FloatingIp floatingIpStore = get(FloatingIpService.class).getFloatingIp(floatingIpId);
try {
FloatingIp floatingIpObj = new DefaultFloatingIp(
floatingIpId,
tenantId == null ? floatingIpStore.tenantId()
: TenantId.tenantId(tenantId),
networkId == null ? floatingIpStore.networkId()
: TenantNetworkId.networkId(networkId),
portId == null ? floatingIpStore.portId()
: VirtualPortId.portId(portId),
routerId == null ? floatingIpStore.routerId()
: RouterId.valueOf(routerId),
floatingIp == null ? floatingIpStore.floatingIp()
: IpAddress.valueOf(floatingIp),
fixedIp == null ? floatingIpStore.fixedIp()
: IpAddress.valueOf(fixedIp),
status == null ? floatingIpStore.status()
: Status.valueOf(status));
Set<FloatingIp> floatingIpSet = Sets.newHashSet(floatingIpObj);
service.updateFloatingIps(floatingIpSet);
} catch (Exception e) {
print(null, e.getMessage());
}
}
示例3: changeJsonToSub
import org.onosproject.vtnrsc.FloatingIp.Status; //导入方法依赖的package包/类
/**
* Returns a collection of floatingIps from floatingIpNodes.
*
* @param floatingIpNodes the floatingIp json node
* @return floatingIps a collection of floatingIp
*/
public Collection<FloatingIp> changeJsonToSub(JsonNode floatingIpNodes) {
checkNotNull(floatingIpNodes, JSON_NOT_NULL);
Map<FloatingIpId, FloatingIp> subMap = new HashMap<FloatingIpId, FloatingIp>();
if (!floatingIpNodes.hasNonNull("id")) {
throw new IllegalArgumentException("id should not be null");
} else if (floatingIpNodes.get("id").asText().isEmpty()) {
throw new IllegalArgumentException("id should not be empty");
}
FloatingIpId id = FloatingIpId.of(floatingIpNodes.get("id")
.asText());
if (!floatingIpNodes.hasNonNull("tenant_id")) {
throw new IllegalArgumentException("tenant_id should not be null");
} else if (floatingIpNodes.get("tenant_id").asText().isEmpty()) {
throw new IllegalArgumentException("tenant_id should not be empty");
}
TenantId tenantId = TenantId.tenantId(floatingIpNodes.get("tenant_id")
.asText());
if (!floatingIpNodes.hasNonNull("floating_network_id")) {
throw new IllegalArgumentException(
"floating_network_id should not be null");
} else if (floatingIpNodes.get("floating_network_id").asText()
.isEmpty()) {
throw new IllegalArgumentException(
"floating_network_id should not be empty");
}
TenantNetworkId networkId = TenantNetworkId.networkId(floatingIpNodes
.get("floating_network_id").asText());
VirtualPortId portId = null;
if (floatingIpNodes.hasNonNull("port_id")) {
portId = VirtualPortId.portId(floatingIpNodes.get("port_id")
.asText());
}
RouterId routerId = null;
if (floatingIpNodes.hasNonNull("router_id")) {
routerId = RouterId.valueOf(floatingIpNodes.get("router_id")
.asText());
}
IpAddress fixedIp = null;
if (floatingIpNodes.hasNonNull("fixed_ip_address")) {
fixedIp = IpAddress.valueOf(floatingIpNodes.get("fixed_ip_address")
.asText());
}
if (!floatingIpNodes.hasNonNull("floating_ip_address")) {
throw new IllegalArgumentException(
"floating_ip_address should not be null");
} else if (floatingIpNodes.get("floating_ip_address").asText()
.isEmpty()) {
throw new IllegalArgumentException(
"floating_ip_address should not be empty");
}
IpAddress floatingIp = IpAddress.valueOf(floatingIpNodes
.get("floating_ip_address").asText());
if (!floatingIpNodes.hasNonNull("status")) {
throw new IllegalArgumentException("status should not be null");
} else if (floatingIpNodes.get("status").asText().isEmpty()) {
throw new IllegalArgumentException("status should not be empty");
}
Status status = Status.valueOf(floatingIpNodes.get("status").asText());
DefaultFloatingIp floatingIpObj = new DefaultFloatingIp(id, tenantId,
networkId,
portId,
routerId,
floatingIp,
fixedIp, status);
subMap.put(id, floatingIpObj);
return Collections.unmodifiableCollection(subMap.values());
}