本文整理匯總了Java中org.onosproject.vtnrsc.FloatingIp.Status類的典型用法代碼示例。如果您正苦於以下問題:Java Status類的具體用法?Java Status怎麽用?Java Status使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Status類屬於org.onosproject.vtnrsc.FloatingIp包,在下文中一共展示了Status類的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());
}