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


Java TenantNetworkId.networkId方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: createDummyGluonNetwork

import org.onosproject.vtnrsc.TenantNetworkId; //导入方法依赖的package包/类
/**
 * Creates dummy gluon network to the VTN.
 *
 * @param state        the base port state
 * @param adminStateUp the base port admin status
 * @param tenantID     the base port tenant ID
 */
private void createDummyGluonNetwork(boolean adminStateUp, String state,
                                     TenantId tenantID) {
    String id = "11111111-1111-1111-1111-111111111111";
    String name = "GluonNetwork";
    String segmentationID = "50";
    String physicalNetwork = "None";

    TenantNetwork network = new DefaultTenantNetwork(TenantNetworkId.networkId(id), name,
                                                     adminStateUp,
                                                     TenantNetwork.State.valueOf(state),
                                                     false, tenantID,
                                                     false,
                                                     TenantNetwork.Type.LOCAL,
                                                     PhysicalNetwork.physicalNetwork(physicalNetwork),
                                                     SegmentationId.segmentationId(segmentationID));

    Set<TenantNetwork> networksSet = Sets.newHashSet(network);
    tenantNetworkService.createNetworks(networksSet);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:27,代码来源:VpnPortManager.java

示例9: 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(network);
    service.createNetworks(networksSet);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:TenantNetworkCreateCommand.java

示例10: execute

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

示例11: testEquals

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

示例12: testConstruction

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

示例13: testEquals

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

示例14: jsonNodeToGateway

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

示例15: createVirtualPort

import org.onosproject.vtnrsc.TenantNetworkId; //导入方法依赖的package包/类
private VirtualPort createVirtualPort(VirtualPortId id) {
    Set<FixedIp> fixedIps;
    Map<String, String> propertyMap;
    Set<AllowedAddressPair> allowedAddressPairs;
    Set<SecurityGroup> securityGroups = Sets.newHashSet();

    String macAddressStr = "fa:12:3e:56:ee:a2";
    String ipAddress = "10.1.1.1";
    String subnet = "1212";
    String hostIdStr = "fa:e2:3e:56:ee:a2";
    String deviceOwner = "james";
    propertyMap = Maps.newHashMap();
    propertyMap.putIfAbsent("deviceOwner", deviceOwner);

    TenantNetworkId networkId = TenantNetworkId.networkId(networkIdStr);
    MacAddress macAddress = MacAddress.valueOf(macAddressStr);
    BindingHostId bindingHostId = BindingHostId.bindingHostId(hostIdStr);
    FixedIp fixedIp = FixedIp.fixedIp(SubnetId.subnetId(subnet),
                                      IpAddress.valueOf(ipAddress));
    fixedIps = Sets.newHashSet();
    fixedIps.add(fixedIp);

    allowedAddressPairs = Sets.newHashSet();
    AllowedAddressPair allowedAddressPair = AllowedAddressPair
            .allowedAddressPair(IpAddress.valueOf(ipAddress),
                                MacAddress.valueOf(macAddressStr));
    allowedAddressPairs.add(allowedAddressPair);

    VirtualPort d1 = new DefaultVirtualPort(id, networkId, true,
                                            propertyMap,
                                            VirtualPort.State.ACTIVE,
                                            macAddress, tenantId, deviceId,
                                            fixedIps, bindingHostId,
                                            allowedAddressPairs,
                                            securityGroups);
    return d1;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:38,代码来源:SfcFlowRuleInstallerImplTest.java


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