当前位置: 首页>>代码示例>>Java>>正文


Java Status类代码示例

本文整理汇总了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());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:FloatingIpCreateCommand.java

示例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());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:29,代码来源:FloatingIpUpdateCommand.java

示例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());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:82,代码来源:FloatingIpWebResource.java


注:本文中的org.onosproject.vtnrsc.FloatingIp.Status类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。