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


Java TenantNetworkId类代码示例

本文整理汇总了Java中org.onosproject.vtnrsc.TenantNetworkId的典型用法代码示例。如果您正苦于以下问题:Java TenantNetworkId类的具体用法?Java TenantNetworkId怎么用?Java TenantNetworkId使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TenantNetworkId类属于org.onosproject.vtnrsc包,在下文中一共展示了TenantNetworkId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPort

import org.onosproject.vtnrsc.TenantNetworkId; //导入依赖的package包/类
/**
 * Get VirtualPort.
 *
 * @param vPortStore EventuallyConsistentMap of VirtualPort
 * @param networkId TenantNetworkId of the VirtualPort
 * @param ip IpAddress of the VirtualPort
 * @return VirtualPort
 */
public static VirtualPort getPort(EventuallyConsistentMap<VirtualPortId, VirtualPort> vPortStore,
                                  TenantNetworkId networkId, IpAddress ip) {
    if (vPortStore != null) {
        List<VirtualPort> vPorts = new ArrayList<>();
        vPortStore.values().stream()
                .filter(p -> p.networkId().equals(networkId))
                .forEach(p -> {
                    Iterator<FixedIp> fixedIps = p.fixedIps().iterator();
                    while (fixedIps.hasNext()) {
                        if (fixedIps.next().ip().equals(ip)) {
                            vPorts.add(p);
                            break;
                        }
                    }
                });
        if (vPorts.size() == 0) {
            return null;
        }
        return vPorts.get(0);
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:31,代码来源:VtnData.java

示例2: activate

import org.onosproject.vtnrsc.TenantNetworkId; //导入依赖的package包/类
@Activate
public void activate() {

    appId = coreService.registerApplication(VTNRSC_APP);

    networkIdAsKeyStore = storageService.<TenantNetworkId, TenantNetwork>consistentMapBuilder()
            .withName(TENANTNETWORK)
            .withApplicationId(appId)
            .withPurgeOnUninstall()
            .withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API),
                                             TenantNetworkId.class,
                                             DefaultTenantNetwork.class,
                                             TenantNetwork.State.class,
                                             TenantId.class,
                                             TenantNetwork.Type.class,
                                             PhysicalNetwork.class,
                                             SegmentationId.class))
            .build().asJavaMap();

    log.info("Started");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:TenantNetworkManager.java

示例3: activate

import org.onosproject.vtnrsc.TenantNetworkId; //导入依赖的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

示例4: activate

import org.onosproject.vtnrsc.TenantNetworkId; //导入依赖的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");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:SubnetManager.java

示例5: getPort

import org.onosproject.vtnrsc.TenantNetworkId; //导入依赖的package包/类
@Override
public VirtualPort getPort(TenantNetworkId networkId, IpAddress ip) {
    checkNotNull(networkId, NETWORKID_NOT_NULL);
    checkNotNull(ip, IP_NOT_NULL);
    List<VirtualPort> vPorts = new ArrayList<>();
    vPortStore.values().stream().filter(p -> p.networkId().equals(networkId))
            .forEach(p -> {
                Iterator<FixedIp> fixedIps = p.fixedIps().iterator();
                while (fixedIps.hasNext()) {
                    if (fixedIps.next().ip().equals(ip)) {
                        vPorts.add(p);
                        break;
                    }
                }
            });
    if (vPorts.size() == 0) {
        return null;
    }
    return vPorts.get(0);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:VirtualPortManager.java

示例6: execute

import org.onosproject.vtnrsc.TenantNetworkId; //导入依赖的package包/类
@Override
protected void execute() {
    TenantNetworkService service = get(TenantNetworkService.class);
    TenantNetwork network = new DefaultTenantNetwork(TenantNetworkId.networkId(id), name,
                                                     adminStateUp,
                                                     TenantNetwork.State.valueOf(state),
                                                     shared, TenantId.tenantId(tenantID),
                                                     routerExternal,
                                                     TenantNetwork.Type.valueOf(type),
                                                     PhysicalNetwork.physicalNetwork(physicalNetwork),
                                                     SegmentationId.segmentationId(segmentationID));

    Set<TenantNetwork> networksSet = Sets.newHashSet();
    networksSet.add(network);
    service.updateNetworks(networksSet);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:TenantNetworkUpdateCommand.java

示例7: execute

import org.onosproject.vtnrsc.TenantNetworkId; //导入依赖的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

示例8: execute

import org.onosproject.vtnrsc.TenantNetworkId; //导入依赖的package包/类
@Override
protected void execute() {
    SubnetService service = get(SubnetService.class);
    if (id == null || networkId == null || tenantId == null) {
        print("id,networkId,tenantId can not be null");
        return;
    }
    Subnet subnet = new DefaultSubnet(SubnetId.subnetId(id), subnetName,
                                      TenantNetworkId.networkId(networkId),
                                      TenantId.tenantId(tenantId), ipVersion,
                                      cidr == null ? null : IpPrefix.valueOf(cidr),
                                      gatewayIp == null ? null : IpAddress.valueOf(gatewayIp),
                                      dhcpEnabled, shared, hostRoutes,
                                      ipV6AddressMode == null ? null : Mode.valueOf(ipV6AddressMode),
                                      ipV6RaMode == null ? null : Mode.valueOf(ipV6RaMode),
                                      allocationPools);

    Set<Subnet> subnetsSet = Sets.newHashSet(subnet);
    service.createSubnets(subnetsSet);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:SubnetCreateCommand.java

示例9: execute

import org.onosproject.vtnrsc.TenantNetworkId; //导入依赖的package包/类
@Override
protected void execute() {
    SubnetService service = get(SubnetService.class);
    if (id == null || networkId == null || tenantId == null) {
        print("id,networkId,tenantId can not be null");
        return;
    }
    Subnet subnet = new DefaultSubnet(SubnetId.subnetId(id), subnetName,
                                      TenantNetworkId.networkId(networkId),
                                      TenantId.tenantId(tenantId), ipVersion,
                                      cidr == null ? null : IpPrefix.valueOf(cidr),
                                      gatewayIp == null ? null : IpAddress.valueOf(gatewayIp),
                                      dhcpEnabled, shared, hostRoutes,
                                      ipV6AddressMode == null ? null : Mode.valueOf(ipV6AddressMode),
                                      ipV6RaMode == null ? null : Mode.valueOf(ipV6RaMode),
                                      allocationPools);
    Set<Subnet> subnetsSet = Sets.newHashSet();
    subnetsSet.add(subnet);
    service.updateSubnets(subnetsSet);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:SubnetUpdateCommand.java

示例10: execute

import org.onosproject.vtnrsc.TenantNetworkId; //导入依赖的package包/类
@Override
protected void execute() {
    Map<String, String> strMap = Maps.newHashMap();
    strMap.putIfAbsent("name", name);
    strMap.putIfAbsent("deviceOwner", deviceOwner);
    strMap.putIfAbsent("bindingvnicType", bindingvnicType);
    strMap.putIfAbsent("bindingvifType", bindingvifType);
    strMap.putIfAbsent("bindingvnicDetails", bindingvnicDetails);
    VirtualPortService service = get(VirtualPortService.class);
    VirtualPort virtualPort = new DefaultVirtualPort(VirtualPortId.portId(id),
                                   TenantNetworkId.networkId(networkId),
                                   false, strMap, VirtualPort.State.ACTIVE,
                                   MacAddress.valueOf(macAddress),
                                   TenantId.tenantId(tenantId),
                                   DeviceId.deviceId(deviceId), Sets.newHashSet(fixedIp),
                                   BindingHostId.bindingHostId(bindingHostId),
                                   allowedAddressPairs, securityGroups);
    Set<VirtualPort> virtualPorts = Sets.newHashSet(virtualPort);
    service.createPorts(virtualPorts);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:VirtualPortCreateCommand.java

示例11: execute

import org.onosproject.vtnrsc.TenantNetworkId; //导入依赖的package包/类
@Override
protected void execute() {
    VirtualPortService service = get(VirtualPortService.class);
    Map<String, String> strMap = Maps.newHashMap();
    strMap.putIfAbsent("name", name);
    strMap.putIfAbsent("deviceOwner", deviceOwner);
    strMap.putIfAbsent("bindingvnicType", bindingvnicType);
    strMap.putIfAbsent("bindingvifType", bindingvifType);
    strMap.putIfAbsent("bindingvnicDetails", bindingvnicDetails);
    VirtualPort virtualPort = new DefaultVirtualPort(VirtualPortId.portId(id),
                                                     TenantNetworkId.networkId(networkId),
                                                     false, strMap, VirtualPort.State.ACTIVE,
                                                     MacAddress.valueOf(macAddress),
                                                     TenantId.tenantId(tenantId),
                                                     DeviceId.deviceId(deviceId), Sets.newHashSet(fixedIp),
                                                     BindingHostId.bindingHostId(bindingHostId),
                                                     allowedAddressPairs, securityGroups);
    Set<VirtualPort> virtualPorts = Sets.newHashSet(virtualPort);
    service.updatePorts(virtualPorts);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:VirtualPortUpdateCommand.java

示例12: activate

import org.onosproject.vtnrsc.TenantNetworkId; //导入依赖的package包/类
@Activate
public void activate() {
    appId = coreService.registerApplication(VTNRSC_APP);
    KryoNamespace.Builder serializer = KryoNamespace
            .newBuilder()
            .register(KryoNamespaces.API)
            .register(Router.class, RouterId.class, DefaultRouter.class,
                      TenantNetworkId.class, TenantId.class,
                      VirtualPortId.class, DefaultRouter.class,
                      RouterGateway.class, Router.Status.class,
                      SubnetId.class, FixedIp.class);
    routerStore = storageService
            .<RouterId, Router>eventuallyConsistentMapBuilder()
            .withName(ROUTER).withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .build();
    routerStore.addListener(routerListener);
    log.info("Started");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:RouterManager.java

示例13: testConstruction

import org.onosproject.vtnrsc.TenantNetworkId; //导入依赖的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()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:DefaultRouterTest.java

示例14: getNetwork

import org.onosproject.vtnrsc.TenantNetworkId; //导入依赖的package包/类
@GET
@Path("{id}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response getNetwork(@PathParam("id") String id) {

    if (!get(TenantNetworkService.class).exists(TenantNetworkId
                                                        .networkId(id))) {
        return Response.status(NOT_FOUND)
                .entity(NETWORK_NOT_FOUND).build();
    }
    TenantNetwork network = nullIsNotFound(get(TenantNetworkService.class)
            .getNetwork(TenantNetworkId.networkId(id)), NETWORK_NOT_FOUND);
    ObjectNode result = new ObjectMapper().createObjectNode();
    result.set("network", new TenantNetworkCodec().encode(network, this));

    return ok(result.toString()).build();

}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:TenantNetworkWebResource.java

示例15: deleteNetworks

import org.onosproject.vtnrsc.TenantNetworkId; //导入依赖的package包/类
@DELETE
@Path("{id}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response deleteNetworks(@PathParam("id") String id) {
    log.debug("Deletes network by identifier {}.", id);
    Set<TenantNetworkId> networkSet = new HashSet<>();
    networkSet.add(TenantNetworkId.networkId(id));
    Boolean issuccess = nullIsNotFound(get(TenantNetworkService.class)
            .removeNetworks(networkSet), NETWORK_NOT_FOUND);
    if (!issuccess) {
        log.debug("Network identifier {} is not existed", id);
        return Response.status(INTERNAL_SERVER_ERROR)
                .entity(NETWORK_ID_NOT_EXIST).build();
    }
    return ok(issuccess.toString()).build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:TenantNetworkWebResource.java


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