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


Java NetworkId.id方法代码示例

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


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

示例1: testAuditWithExtraneousMissingGroups

import org.onosproject.incubator.net.virtual.NetworkId; //导入方法依赖的package包/类
private void testAuditWithExtraneousMissingGroups(NetworkId networkId,
                                                  DeviceId deviceId) {
    VirtualNetworkGroupManager groupManager;
    VirtualGroupProviderService providerService;
    if (networkId.id() == 1) {
        groupManager = groupManager1;
        providerService = providerService1;
    } else {
        groupManager = groupManager2;
        providerService = providerService2;
    }

    PortNumber[] ports1 = {PortNumber.portNumber(31),
            PortNumber.portNumber(32)};
    PortNumber[] ports2 = {PortNumber.portNumber(41),
            PortNumber.portNumber(42)};
    GroupId gId1 = new GroupId(1);
    Group group1 = createSouthboundGroupEntry(gId1,
                                              Arrays.asList(ports1),
                                              0, deviceId);
    GroupId gId2 = new GroupId(2);
    Group group2 = createSouthboundGroupEntry(gId2,
                                              Arrays.asList(ports2),
                                              0, deviceId);
    List<Group> groupEntries = Arrays.asList(group1, group2);
    providerService.pushGroupMetrics(deviceId, groupEntries);
    GroupKey key = new DefaultGroupKey("group1BeforeAudit".getBytes());
    Group createdGroup = groupManager.getGroup(deviceId, key);
    List<GroupOperation> expectedGroupOps = Arrays.asList(
            GroupOperation.createDeleteGroupOperation(gId1,
                                                      Group.Type.SELECT),
            GroupOperation.createDeleteGroupOperation(gId2,
                                                      Group.Type.SELECT),
            GroupOperation.createAddGroupOperation(createdGroup.id(),
                                                   Group.Type.SELECT,
                                                   createdGroup.buckets()));
    if (deviceId.equals(VDID1)) {
        provider.validate(networkId, deviceId, expectedGroupOps);
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:41,代码来源:VirtualNetworkGroupManagerTest.java

示例2: testPurgeGroupEntry

import org.onosproject.incubator.net.virtual.NetworkId; //导入方法依赖的package包/类
private void testPurgeGroupEntry(NetworkId networkId, DeviceId deviceId) {
    VirtualNetworkGroupManager groupManager;
    if (networkId.id() == 1) {
        groupManager = groupManager1;
    } else {
        groupManager = groupManager2;
    }

    assertEquals(1, Iterables.size(groupManager.getGroups(deviceId, appId)));
    groupManager.purgeGroupEntries(deviceId);
    assertEquals(0, Iterables.size(groupManager.getGroups(deviceId, appId)));
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:13,代码来源:VirtualNetworkGroupManagerTest.java

示例3: testRemoveGroup

import org.onosproject.incubator.net.virtual.NetworkId; //导入方法依赖的package包/类
private void testRemoveGroup(NetworkId networkId, DeviceId deviceId) {
    VirtualNetworkGroupManager groupManager;
    VirtualGroupProviderService providerService;
    TestGroupListener listener;

    if (networkId.id() == 1) {
        groupManager = groupManager1;
        providerService = providerService1;
        listener = listener1;
    } else {
        groupManager = groupManager2;
        providerService = providerService2;
        listener = listener2;
    }

    GroupKey currKey = new DefaultGroupKey("group1RemoveBuckets".getBytes());
    Group existingGroup = groupManager.getGroup(deviceId, currKey);
    groupManager.removeGroup(deviceId, currKey, appId);
    List<GroupOperation> expectedGroupOps = Collections.singletonList(
            GroupOperation.createDeleteGroupOperation(existingGroup.id(),
                                                      Group.Type.SELECT));
    if (deviceId.equals(VDID1)) {
        provider.validate(networkId, deviceId, expectedGroupOps);
    }

    List<Group> groupEntries = Collections.emptyList();
    providerService.pushGroupMetrics(deviceId, groupEntries);
    listener.validateEvent(Collections.singletonList(GroupEvent.Type.GROUP_REMOVED));
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:30,代码来源:VirtualNetworkGroupManagerTest.java

示例4: testInitialAuditWithPendingGroupRequests

import org.onosproject.incubator.net.virtual.NetworkId; //导入方法依赖的package包/类
private void testInitialAuditWithPendingGroupRequests(NetworkId networkId,
                                                      DeviceId deviceId) {
    VirtualNetworkGroupManager groupManager;
    VirtualGroupProviderService providerService;
    if (networkId.id() == 1) {
        groupManager = groupManager1;
        providerService = providerService1;
    } else {
        groupManager = groupManager2;
        providerService = providerService2;
    }

    PortNumber[] ports1 = {PortNumber.portNumber(31),
            PortNumber.portNumber(32)};
    PortNumber[] ports2 = {PortNumber.portNumber(41),
            PortNumber.portNumber(42)};
    GroupId gId1 = new GroupId(1);
    Group group1 = createSouthboundGroupEntry(gId1,
                                              Arrays.asList(ports1),
                                              0, deviceId);
    GroupId gId2 = new GroupId(2);
    // Non zero reference count will make the group manager to queue
    // the extraneous groups until reference count is zero.
    Group group2 = createSouthboundGroupEntry(gId2,
                                              Arrays.asList(ports2),
                                              2, deviceId);
    List<Group> groupEntries = Arrays.asList(group1, group2);
    providerService.pushGroupMetrics(deviceId, groupEntries);
    // First group metrics would trigger the device audit completion
    // post which all pending group requests are also executed.
    GroupKey key = new DefaultGroupKey("group1BeforeAudit".getBytes());
    Group createdGroup = groupManager.getGroup(deviceId, key);
    int createdGroupId = createdGroup.id().id();
    assertNotEquals(gId1.id().intValue(), createdGroupId);
    assertNotEquals(gId2.id().intValue(), createdGroupId);

    List<GroupOperation> expectedGroupOps = Arrays.asList(
            GroupOperation.createDeleteGroupOperation(gId1,
                                                      Group.Type.SELECT),
            GroupOperation.createAddGroupOperation(
                    createdGroup.id(),
                    Group.Type.SELECT,
                    createdGroup.buckets()));
    if (deviceId.equals(VDID1)) {
        provider.validate(networkId, deviceId, expectedGroupOps);
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:48,代码来源:VirtualNetworkGroupManagerTest.java


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