本文整理匯總了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");
}
示例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());
}
}
示例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());
}
}
示例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();
}
示例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()));
}
示例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");
}
示例7: testImmutability
import org.onosproject.vtnrsc.DefaultFloatingIp; //導入依賴的package包/類
/**
* Checks that the DefaultFloatingIp class is immutable.
*/
@Test
public void testImmutability() {
assertThatClassIsImmutable(DefaultFloatingIp.class);
}
示例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");
}
示例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());
}