本文整理汇总了Java中org.onosproject.vtnrsc.RouterGateway.routerGateway方法的典型用法代码示例。如果您正苦于以下问题:Java RouterGateway.routerGateway方法的具体用法?Java RouterGateway.routerGateway怎么用?Java RouterGateway.routerGateway使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.vtnrsc.RouterGateway
的用法示例。
在下文中一共展示了RouterGateway.routerGateway方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testConstruction
import org.onosproject.vtnrsc.RouterGateway; //导入方法依赖的package包/类
/**
* Checks the construction of a DefaultRouter object.
*/
@Test
public void testConstruction() {
final TenantId tenantId = TenantId.tenantId(tenantIdStr);
final VirtualPortId portId = VirtualPortId.portId(virtualPortId);
final RouterId routerId = RouterId.valueOf(routeIdStr1);
final TenantNetworkId networkId = TenantNetworkId
.networkId(tenantNetworkId);
final RouterGateway routerGateway = RouterGateway.routerGateway(
networkId,
true,
Collections
.emptySet());
Router r1 = new DefaultRouter(routerId, routerName, false,
Router.Status.ACTIVE, false,
routerGateway, portId, tenantId, null);
assertThat(routerId, is(notNullValue()));
assertThat(routerId, is(r1.id()));
assertThat(tenantId, is(notNullValue()));
assertThat(tenantId, is(r1.tenantId()));
assertThat(routerGateway, is(notNullValue()));
assertThat(routerGateway, is(r1.externalGatewayInfo()));
}
示例2: testEquals
import org.onosproject.vtnrsc.RouterGateway; //导入方法依赖的package包/类
/**
* Checks the operation of equals().
*/
@Test
public void testEquals() {
final TenantId tenantId = TenantId.tenantId(tenantIdStr);
final VirtualPortId portId = VirtualPortId.portId(virtualPortId);
final RouterId routerId1 = RouterId.valueOf(routeIdStr1);
final RouterId routerId2 = RouterId.valueOf(routeIdStr2);
final TenantNetworkId networkId = TenantNetworkId
.networkId(tenantNetworkId);
final RouterGateway routerGateway = RouterGateway.routerGateway(
networkId,
true,
Collections
.emptySet());
Router r1 = new DefaultRouter(routerId1, routerName, false,
Router.Status.ACTIVE, false,
routerGateway, portId, tenantId, null);
Router r2 = new DefaultRouter(routerId1, routerName, false,
Router.Status.ACTIVE, false,
routerGateway, portId, tenantId, null);
Router r3 = new DefaultRouter(routerId2, routerName, false,
Router.Status.ACTIVE, false,
routerGateway, portId, tenantId, null);
new EqualsTester().addEqualityGroup(r1, r2).addEqualityGroup(r3)
.testEquals();
}
示例3: jsonNodeToGateway
import org.onosproject.vtnrsc.RouterGateway; //导入方法依赖的package包/类
/**
* Changes JsonNode Gateway to the Gateway.
*
* @param gateway the gateway JsonNode
* @return gateway
*/
private RouterGateway jsonNodeToGateway(JsonNode gateway) {
checkNotNull(gateway, JSON_NOT_NULL);
if (!gateway.hasNonNull("network_id")) {
throw new IllegalArgumentException("network_id should not be null");
} else if (gateway.get("network_id").asText().isEmpty()) {
throw new IllegalArgumentException("network_id should not be empty");
}
TenantNetworkId networkId = TenantNetworkId
.networkId(gateway.get("network_id").asText());
if (!gateway.hasNonNull("enable_snat")) {
throw new IllegalArgumentException("enable_snat should not be null");
} else if (gateway.get("enable_snat").asText().isEmpty()) {
throw new IllegalArgumentException("enable_snat should not be empty");
}
checkArgument(gateway.get("enable_snat").isBoolean(),
"enable_snat should be boolean");
boolean enableSnat = gateway.get("enable_snat").asBoolean();
if (!gateway.hasNonNull("external_fixed_ips")) {
throw new IllegalArgumentException("external_fixed_ips should not be null");
} else if (gateway.get("external_fixed_ips").isNull()) {
throw new IllegalArgumentException("external_fixed_ips should not be empty");
}
Iterable<FixedIp> fixedIpList = jsonNodeToFixedIp(gateway
.get("external_fixed_ips"));
RouterGateway gatewayObj = RouterGateway
.routerGateway(networkId, enableSnat, Sets.newHashSet(fixedIpList));
return gatewayObj;
}