當前位置: 首頁>>代碼示例>>Java>>正文


Java DefaultFloatingIp類代碼示例

本文整理匯總了Java中org.onosproject.vtnrsc.DefaultFloatingIp的典型用法代碼示例。如果您正苦於以下問題:Java DefaultFloatingIp類的具體用法?Java DefaultFloatingIp怎麽用?Java DefaultFloatingIp使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DefaultFloatingIp類屬於org.onosproject.vtnrsc包,在下文中一共展示了DefaultFloatingIp類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: activate

import org.onosproject.vtnrsc.DefaultFloatingIp; //導入依賴的package包/類
@Activate
public void activate() {
    appId = coreService.registerApplication(VTNRSC_APP);
    KryoNamespace.Builder serializer = KryoNamespace
            .newBuilder()
            .register(KryoNamespaces.API)
            .register(FloatingIp.class, FloatingIpId.class,
                      TenantNetworkId.class, TenantId.class,
                      FloatingIp.Status.class, RouterId.class,
                      VirtualPortId.class, DefaultFloatingIp.class,
                      UUID.class);
    floatingIpStore = storageService
            .<FloatingIpId, FloatingIp>eventuallyConsistentMapBuilder()
            .withName(FLOATINGIPSTORE).withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .build();
    floatingIpBindStore = storageService
            .<FloatingIpId, FloatingIp>eventuallyConsistentMapBuilder()
            .withName(FLOATINGIPBINDSTORE).withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .build();
    floatingIpStore.addListener(floatingIpListener);
    log.info("Started");
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:25,代碼來源:FloatingIpManager.java

示例2: execute

import org.onosproject.vtnrsc.DefaultFloatingIp; //導入依賴的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

示例3: execute

import org.onosproject.vtnrsc.DefaultFloatingIp; //導入依賴的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

示例4: testEquals

import org.onosproject.vtnrsc.DefaultFloatingIp; //導入依賴的package包/類
/**
 * Checks the operation of equals().
 */
@Test
public void testEquals() {
    final TenantId tenantId = TenantId.tenantId(tenantIdStr);
    final TenantNetworkId networkId = TenantNetworkId
            .networkId(tenantNetworkId);
    final VirtualPortId portId = VirtualPortId.portId(virtualPortId);
    final RouterId routerId = RouterId.valueOf(routerIdStr);
    final FloatingIpId id1 = FloatingIpId.of(floatingIpIdStr1);
    final FloatingIpId id2 = FloatingIpId.of(floatingIpIdStr2);
    final IpAddress floatingIpAddress = IpAddress.valueOf(floatingIpStr);
    final IpAddress fixedIpAddress = IpAddress.valueOf(fixedIpStr);

    FloatingIp fip1 = new DefaultFloatingIp(id1, tenantId, networkId,
                                            portId, routerId,
                                            floatingIpAddress,
                                            fixedIpAddress,
                                            FloatingIp.Status.ACTIVE);
    FloatingIp fip2 = new DefaultFloatingIp(id1, tenantId, networkId,
                                            portId, routerId,
                                            floatingIpAddress,
                                            fixedIpAddress,
                                            FloatingIp.Status.ACTIVE);
    FloatingIp fip3 = new DefaultFloatingIp(id2, tenantId, networkId,
                                            portId, routerId,
                                            floatingIpAddress,
                                            fixedIpAddress,
                                            FloatingIp.Status.ACTIVE);

    new EqualsTester().addEqualityGroup(fip1, fip2).addEqualityGroup(fip3)
            .testEquals();
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:35,代碼來源:DefaultFloatingIpTest.java

示例5: testConstruction

import org.onosproject.vtnrsc.DefaultFloatingIp; //導入依賴的package包/類
/**
 * Checks the construction of a DefaultFloatingIp object.
 */
@Test
public void testConstruction() {
    final TenantId tenantId = TenantId.tenantId(tenantIdStr);
    final TenantNetworkId networkId = TenantNetworkId
            .networkId(tenantNetworkId);
    final VirtualPortId portId = VirtualPortId.portId(virtualPortId);
    final RouterId routerId = RouterId.valueOf(routerIdStr);
    final FloatingIpId id = FloatingIpId.of(floatingIpIdStr1);
    final IpAddress floatingIpAddress = IpAddress.valueOf(floatingIpStr);
    final IpAddress fixedIpAddress = IpAddress.valueOf(fixedIpStr);

    FloatingIp fip = new DefaultFloatingIp(id, tenantId, networkId, portId,
                                           routerId, floatingIpAddress,
                                           fixedIpAddress,
                                           FloatingIp.Status.ACTIVE);
    assertThat(id, is(notNullValue()));
    assertThat(id, is(fip.id()));
    assertThat(tenantId, is(notNullValue()));
    assertThat(tenantId, is(fip.tenantId()));
    assertThat(networkId, is(notNullValue()));
    assertThat(networkId, is(fip.networkId()));
    assertThat(portId, is(notNullValue()));
    assertThat(portId, is(fip.portId()));
    assertThat(routerId, is(notNullValue()));
    assertThat(routerId, is(fip.routerId()));
    assertThat(floatingIpAddress, is(notNullValue()));
    assertThat(floatingIpAddress, is(fip.floatingIp()));
    assertThat(fixedIpAddress, is(notNullValue()));
    assertThat(fixedIpAddress, is(fip.fixedIp()));
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:34,代碼來源:DefaultFloatingIpTest.java

示例6: activate

import org.onosproject.vtnrsc.DefaultFloatingIp; //導入依賴的package包/類
@Activate
public void activate() {

    appId = coreService.registerApplication(APP_ID);

    KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
            .register(KryoNamespaces.API)
            .register(MultiValuedTimestamp.class)
            .register(TenantNetworkId.class)
            .register(Host.class)
            .register(TenantNetwork.class)
            .register(TenantNetworkId.class)
            .register(TenantId.class)
            .register(SubnetId.class)
            .register(BasePortId.class)
            .register(BasePort.State.class)
            .register(AllowedAddressPair.class)
            .register(FixedIp.class)
            .register(FloatingIp.class)
            .register(FloatingIpId.class)
            .register(FloatingIp.Status.class)
            .register(UUID.class)
            .register(DefaultFloatingIp.class)
            .register(BindingHostId.class)
            .register(SecurityGroup.class)
            .register(IpAddress.class)
            .register(DefaultBasePort.class)
            .register(RouterId.class)
            .register(TenantRouter.class)
            .register(BasePort.class);
    vPortStore = storageService
            .<BasePortId, BasePort>eventuallyConsistentMapBuilder()
            .withName(BASE_PORT_STORE).withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .build();
    log.info("Started");
}
 
開發者ID:opennetworkinglab,項目名稱:onos,代碼行數:38,代碼來源:BasePortManager.java

示例7: testImmutability

import org.onosproject.vtnrsc.DefaultFloatingIp; //導入依賴的package包/類
/**
 * Checks that the DefaultFloatingIp class is immutable.
 */
@Test
public void testImmutability() {
    assertThatClassIsImmutable(DefaultFloatingIp.class);
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:8,代碼來源:DefaultFloatingIpTest.java

示例8: activate

import org.onosproject.vtnrsc.DefaultFloatingIp; //導入依賴的package包/類
@Activate
public void activate() {

    appId = coreService.registerApplication(VTNRSC_APP);

    eventDispatcher.addSink(VirtualPortEvent.class, listenerRegistry);

    KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
            .register(KryoNamespaces.API)
            .register(MultiValuedTimestamp.class)
            .register(TenantNetworkId.class)
            .register(Host.class)
            .register(TenantNetwork.class)
            .register(TenantNetworkId.class)
            .register(TenantId.class)
            .register(SubnetId.class)
            .register(VirtualPortId.class)
            .register(VirtualPort.State.class)
            .register(AllowedAddressPair.class)
            .register(FixedIp.class)
            .register(FloatingIp.class)
            .register(FloatingIpId.class)
            .register(FloatingIp.Status.class)
            .register(UUID.class)
            .register(DefaultFloatingIp.class)
            .register(BindingHostId.class)
            .register(SecurityGroup.class)
            .register(IpAddress.class)
            .register(DefaultVirtualPort.class)
            .register(RouterId.class)
            .register(TenantRouter.class)
            .register(VirtualPort.class);
    vPortStore = storageService
            .<VirtualPortId, VirtualPort>eventuallyConsistentMapBuilder()
            .withName(VIRTUALPORT).withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .build();

    vPortStore.addListener(virtualPortListener);
    log.info("Started");
}
 
開發者ID:opennetworkinglab,項目名稱:onos,代碼行數:42,代碼來源:VirtualPortManager.java

示例9: changeJsonToSub

import org.onosproject.vtnrsc.DefaultFloatingIp; //導入依賴的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.DefaultFloatingIp類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。