本文整理汇总了Java中org.onosproject.vtnrsc.DefaultHostRoute类的典型用法代码示例。如果您正苦于以下问题:Java DefaultHostRoute类的具体用法?Java DefaultHostRoute怎么用?Java DefaultHostRoute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultHostRoute类属于org.onosproject.vtnrsc包,在下文中一共展示了DefaultHostRoute类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: activate
import org.onosproject.vtnrsc.DefaultHostRoute; //导入依赖的package包/类
@Activate
public void activate() {
appId = coreService.registerApplication(VTNRSC_APP);
subnetStore = storageService.<SubnetId, Subnet>consistentMapBuilder()
.withName(SUBNET)
.withApplicationId(appId)
.withPurgeOnUninstall()
.withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API),
Subnet.class,
SubnetId.class,
TenantNetworkId.class,
TenantId.class,
HostRoute.class,
DefaultHostRoute.class,
Subnet.Mode.class,
AllocationPool.class,
DefaultAllocationPool.class,
DefaultSubnet.class,
IpAddress.Version.class))
.build().asJavaMap();
log.info("Started");
}
示例2: jsonNodeToHostRoutes
import org.onosproject.vtnrsc.DefaultHostRoute; //导入依赖的package包/类
/**
* Changes hostRoutes JsonNode to a collection of the hostRoutes.
*
* @param hostRoutes the hostRoutes json node
* @return a collection of hostRoutes
*/
public Iterable<HostRoute> jsonNodeToHostRoutes(JsonNode hostRoutes) {
checkNotNull(hostRoutes, JSON_NOT_NULL);
ConcurrentMap<Integer, HostRoute> hostRouteMaps = Maps
.newConcurrentMap();
Integer i = 0;
for (JsonNode node : hostRoutes) {
IpAddress nexthop = IpAddress.valueOf(node.get("nexthop").asText());
IpPrefix destination = IpPrefix.valueOf(node.get("destination")
.asText());
HostRoute hostRoute = new DefaultHostRoute(nexthop, destination);
hostRouteMaps.putIfAbsent(i, hostRoute);
i++;
}
return Collections.unmodifiableCollection(hostRouteMaps.values());
}