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


Java PortPairGroup类代码示例

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


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

示例1: getServiceFunctions

import org.onosproject.vtnrsc.PortPairGroup; //导入依赖的package包/类
@Override
public List<ServiceFunctionGroup> getServiceFunctions(PortChainId portChainId) {
    List<ServiceFunctionGroup> serviceFunctionGroupList = Lists.newArrayList();
    PortChain portChain = portChainService.getPortChain(portChainId);
    // Go through the port pair group list
    List<PortPairGroupId> portPairGrpList = portChain.portPairGroups();
    ListIterator<PortPairGroupId> listGrpIterator = portPairGrpList.listIterator();

    while (listGrpIterator.hasNext()) {
        PortPairGroupId portPairGroupId = listGrpIterator.next();
        PortPairGroup portPairGroup = portPairGroupService.getPortPairGroup(portPairGroupId);
        ServiceFunctionGroup sfg = new ServiceFunctionGroup(portPairGroup.name(), portPairGroup.description(),
                                                            portPairGroup.portPairLoadMap());
        serviceFunctionGroupList.add(sfg);
    }
    return ImmutableList.copyOf(serviceFunctionGroupList);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:PortChainSfMapManager.java

示例2: activate

import org.onosproject.vtnrsc.PortPairGroup; //导入依赖的package包/类
@Activate
public void activate() {
    eventDispatcher.addSink(PortPairGroupEvent.class, listenerRegistry);
    KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
            .register(KryoNamespaces.API)
            .register(MultiValuedTimestamp.class)
            .register(PortPairGroup.class, PortPairGroupId.class, UUID.class, DefaultPortPairGroup.class,
                      TenantId.class, PortPairId.class);

    portPairGroupStore = storageService
            .<PortPairGroupId, PortPairGroup>eventuallyConsistentMapBuilder()
            .withName("portpairgroupstore").withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp()).build();

    portPairGroupStore.addListener(portPairGroupListener);

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

示例3: updatePortPairGroup

import org.onosproject.vtnrsc.PortPairGroup; //导入依赖的package包/类
@Override
public boolean updatePortPairGroup(PortPairGroup portPairGroup) {
    checkNotNull(portPairGroup, PORT_PAIR_GROUP_NULL);

    if (!portPairGroupStore.containsKey(portPairGroup.portPairGroupId())) {
        log.debug("The portPairGroup is not exist whose identifier was {} ",
                  portPairGroup.portPairGroupId().toString());
        return false;
    }

    portPairGroupStore.put(portPairGroup.portPairGroupId(), portPairGroup);

    if (!portPairGroup.equals(portPairGroupStore.get(portPairGroup.portPairGroupId()))) {
        log.debug("The portPairGroup is updated failed whose identifier was {} ",
                  portPairGroup.portPairGroupId().toString());
        return false;
    }
    return true;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:PortPairGroupManager.java

示例4: createPortPairGroup

import org.onosproject.vtnrsc.PortPairGroup; //导入依赖的package包/类
/**
 * Creates a new port pair group.
 *
 * @param stream   port pair group from JSON
 * @return status of the request - CREATED if the JSON is correct,
 * BAD_REQUEST if the JSON is invalid
 */
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createPortPairGroup(InputStream stream) {

    try {
        ObjectMapper mapper = new ObjectMapper();
        ObjectNode jsonTree = (ObjectNode) mapper.readTree(stream);
        JsonNode port = jsonTree.get("port_pair_group");

        PortPairGroup portPairGroup = codec(PortPairGroup.class).decode((ObjectNode) port, this);
        Boolean issuccess = nullIsNotFound(get(PortPairGroupService.class).createPortPairGroup(portPairGroup),
                                           PORT_PAIR_GROUP_NOT_FOUND);
        return Response.status(OK).entity(issuccess.toString()).build();
    } catch (IOException e) {
        log.error("Exception while creating port pair group {}.", e.toString());
        throw new IllegalArgumentException(e);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:PortPairGroupWebResource.java

示例5: updatePortPairGroup

import org.onosproject.vtnrsc.PortPairGroup; //导入依赖的package包/类
/**
 * Update details of a specified port pair group id.
 *
 * @param id port pair group id
 * @param stream port pair group from json
 * @return 200 OK, 404 if given identifier does not exist
 */
@PUT
@Path("{group_id}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response updatePortPairGroup(@PathParam("group_id") String id,
                                    final InputStream stream) {
    try {
        ObjectMapper mapper = new ObjectMapper();
        ObjectNode jsonTree = (ObjectNode) mapper.readTree(stream);
        JsonNode port = jsonTree.get("port_pair_group");
        PortPairGroup portPairGroup = codec(PortPairGroup.class).decode((ObjectNode) port, this);
        Boolean isSuccess = nullIsNotFound(get(PortPairGroupService.class).updatePortPairGroup(portPairGroup),
                                           PORT_PAIR_GROUP_NOT_FOUND);
        return Response.status(OK).entity(isSuccess.toString()).build();
    } catch (IOException e) {
        log.error("Update port pair group failed because of exception {}.", e.toString());
        throw new IllegalArgumentException(e);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:PortPairGroupWebResource.java

示例6: sfcPorts

import org.onosproject.vtnrsc.PortPairGroup; //导入依赖的package包/类
private List<VirtualPort> sfcPorts(PortChain pchain) {
    List<PortPairGroupId> portPairGroupList = pchain.portPairGroups();
    PortPairGroupService ppgs = get(PortPairGroupService.class);
    PortPairService pps = get(PortPairService.class);
    VirtualPortService vps = get(VirtualPortService.class);
    List<VirtualPort> vpList = new ArrayList<VirtualPort>();
    if (portPairGroupList != null) {
        portPairGroupList.stream().forEach(ppgid -> {
            PortPairGroup ppg = ppgs.getPortPairGroup(ppgid);
            List<PortPairId> portPairList = ppg.portPairs();
            if (portPairList != null) {
                portPairList.stream().forEach(ppid -> {
                    PortPair pp = pps.getPortPair(ppid);
                    VirtualPort vp = vps.getPort(VirtualPortId.portId(pp.ingress()));
                    vpList.add(vp);
                });
            }
        });
    }
    return vpList;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:SfcViewMessageHandler.java

示例7: codecPortPairGroupTest

import org.onosproject.vtnrsc.PortPairGroup; //导入依赖的package包/类
/**
 * Checks that a simple rule decodes properly.
 *
 * @throws IOException if the resource cannot be processed
 */
@Test
public void codecPortPairGroupTest() throws IOException {

    PortPairGroup portPairGroup = getPortPairGroup("portPairGroup.json");

    assertThat(portPairGroup, notNullValue());

    PortPairGroupId portPairGroupId = PortPairGroupId.of("4512d643-24fc-4fae-af4b-321c5e2eb3d1");
    TenantId tenantId = TenantId.tenantId("d382007aa9904763a801f68ecf065cf5");

    assertThat(portPairGroup.portPairGroupId().toString(), is(portPairGroupId.toString()));
    assertThat(portPairGroup.name(), is("PG1"));
    assertThat(portPairGroup.tenantId().toString(), is(tenantId.toString()));
    assertThat(portPairGroup.description(), is("Two port-pairs"));
    assertThat(portPairGroup.portPairs(), notNullValue());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:PortPairGroupCodecTest.java

示例8: testGetPortPairGroupId

import org.onosproject.vtnrsc.PortPairGroup; //导入依赖的package包/类
/**
 * Tests the result of a rest api GET for port pair group id.
 */
@Test
public void testGetPortPairGroupId() {

    final Set<PortPairGroup> portPairGroups = new HashSet<>();
    portPairGroups.add(portPairGroup1);

    expect(portPairGroupService.exists(anyObject())).andReturn(true).anyTimes();
    expect(portPairGroupService.getPortPairGroup(anyObject())).andReturn(portPairGroup1).anyTimes();
    replay(portPairGroupService);

    final WebTarget wt = target();
    final String response = wt.path("port_pair_groups/4512d643-24fc-4fae-af4b-321c5e2eb3d1")
            .request().get(String.class);
    final JsonObject result = Json.parse(response).asObject();
    assertThat(result, notNullValue());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:PortPairGroupResourceTest.java

示例9: installFlowClassifier

import org.onosproject.vtnrsc.PortPairGroup; //导入依赖的package包/类
@Override
public ConnectPoint installFlowClassifier(PortChain portChain, NshServicePathId nshSpiId) {
    checkNotNull(portChain, PORT_CHAIN_NOT_NULL);
    // Get the portPairGroup
    List<PortPairGroupId> llPortPairGroupIdList = portChain.portPairGroups();
    ListIterator<PortPairGroupId> portPairGroupIdListIterator = llPortPairGroupIdList.listIterator();
    PortPairGroupId portPairGroupId = portPairGroupIdListIterator.next();
    PortPairGroup portPairGroup = portPairGroupService.getPortPairGroup(portPairGroupId);
    List<PortPairId> llPortPairIdList = portPairGroup.portPairs();

    // Get port pair
    ListIterator<PortPairId> portPairListIterator = llPortPairIdList.listIterator();
    PortPairId portPairId = portPairListIterator.next();
    PortPair portPair = portPairService.getPortPair(portPairId);

    return installSfcClassifierRules(portChain, portPair, nshSpiId, null, Objective.Operation.ADD);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:SfcFlowRuleInstallerImpl.java

示例10: unInstallFlowClassifier

import org.onosproject.vtnrsc.PortPairGroup; //导入依赖的package包/类
@Override
public ConnectPoint unInstallFlowClassifier(PortChain portChain, NshServicePathId nshSpiId) {
    checkNotNull(portChain, PORT_CHAIN_NOT_NULL);
    // Get the portPairGroup
    List<PortPairGroupId> llPortPairGroupIdList = portChain.portPairGroups();
    ListIterator<PortPairGroupId> portPairGroupIdListIterator = llPortPairGroupIdList.listIterator();
    PortPairGroupId portPairGroupId = portPairGroupIdListIterator.next();
    PortPairGroup portPairGroup = portPairGroupService.getPortPairGroup(portPairGroupId);
    List<PortPairId> llPortPairIdList = portPairGroup.portPairs();

    // Get port pair
    ListIterator<PortPairId> portPairListIterator = llPortPairIdList.listIterator();
    PortPairId portPairId = portPairListIterator.next();
    PortPair portPair = portPairService.getPortPair(portPairId);

    return installSfcClassifierRules(portChain, portPair, nshSpiId, null, Objective.Operation.REMOVE);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:SfcFlowRuleInstallerImpl.java

示例11: testOnPortPairGroupCreated

import org.onosproject.vtnrsc.PortPairGroup; //导入依赖的package包/类
/**
 * Checks the operation of onPortPairGroupCreated() method.
 */
@Test
public void testOnPortPairGroupCreated() {
    final PortPairGroupId portPairGroupId = PortPairGroupId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
    final TenantId tenantId = TenantId.tenantId("1");
    final String name = "PortPairGroup";
    final String description = "PortPairGroup";
    final List<PortPairId> portPairIdList = new LinkedList<PortPairId>();
    DefaultPortPairGroup.Builder portPairGroupBuilder = new DefaultPortPairGroup.Builder();
    PortPairGroup portPairGroup = null;
    SfcService sfcService = new SfcManager();

    // create port-pair-id list
    PortPairId portPairId = PortPairId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae");
    portPairIdList.add(portPairId);
    portPairId = PortPairId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae");
    portPairIdList.add(portPairId);

    // create port pair
    portPairGroup = portPairGroupBuilder.setId(portPairGroupId).setTenantId(tenantId).setName(name)
            .setDescription(description).setPortPairs(portPairIdList).build();
    sfcService.onPortPairGroupCreated(portPairGroup);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:SfcManagerTest.java

示例12: testOnPortPairGroupDeleted

import org.onosproject.vtnrsc.PortPairGroup; //导入依赖的package包/类
/**
 * Checks the operation of onPortPairGroupDeleted() method.
 */
@Test
public void testOnPortPairGroupDeleted() {
    final PortPairGroupId portPairGroupId = PortPairGroupId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
    final TenantId tenantId = TenantId.tenantId("1");
    final String name = "PortPairGroup";
    final String description = "PortPairGroup";
    final List<PortPairId> portPairIdList = new LinkedList<PortPairId>();
    DefaultPortPairGroup.Builder portPairGroupBuilder = new DefaultPortPairGroup.Builder();
    PortPairGroup portPairGroup = null;
    SfcService sfcService = new SfcManager();

    // create port-pair-id list
    PortPairId portPairId = PortPairId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae");
    portPairIdList.add(portPairId);
    portPairId = PortPairId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae");
    portPairIdList.add(portPairId);

    // create port pair
    portPairGroup = portPairGroupBuilder.setId(portPairGroupId).setTenantId(tenantId).setName(name)
            .setDescription(description).setPortPairs(portPairIdList).build();
    sfcService.onPortPairGroupDeleted(portPairGroup);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:SfcManagerTest.java

示例13: sfcPorts

import org.onosproject.vtnrsc.PortPairGroup; //导入依赖的package包/类
private List<VirtualPort> sfcPorts(PortChain pchain) {
    List<PortPairGroupId> portPairGroupList = pchain.portPairGroups();
    PortPairGroupService ppgs = get(PortPairGroupService.class);
    PortPairService pps = get(PortPairService.class);
    VirtualPortService vps = get(VirtualPortService.class);
    List<VirtualPort> vpList = new ArrayList<VirtualPort>();
    if (portPairGroupList != null) {
        portPairGroupList.forEach(ppgid -> {
            PortPairGroup ppg = ppgs.getPortPairGroup(ppgid);
            List<PortPairId> portPairList = ppg.portPairs();
            if (portPairList != null) {
                portPairList.forEach(ppid -> {
                    PortPair pp = pps.getPortPair(ppid);
                    VirtualPort vp = vps.getPort(VirtualPortId.portId(pp.ingress()));
                    vpList.add(vp);
                });
            }
        });
    }
    return vpList;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:22,代码来源:SfcViewMessageHandler.java

示例14: VtnRscEventFeedback

import org.onosproject.vtnrsc.PortPairGroup; //导入依赖的package包/类
/**
 * Creates VtnRscEventFeedback object.
 *
 * @param portPairGroup the Port-Pair-Group
 */
public VtnRscEventFeedback(PortPairGroup portPairGroup) {
    this.floaingtIp = null;
    this.router = null;
    this.routerInterface = null;
    this.portPair = null;
    this.portPairGroup = checkNotNull(portPairGroup,
            "Port-Pair-Group cannot be null");
    this.flowClassifier = null;
    this.portChain = null;
    this.virtualPort = null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:VtnRscEventFeedback.java

示例15: createPortPairGroup

import org.onosproject.vtnrsc.PortPairGroup; //导入依赖的package包/类
@Override
public boolean createPortPairGroup(PortPairGroup portPairGroup) {
    checkNotNull(portPairGroup, PORT_PAIR_GROUP_NULL);

    portPairGroupStore.put(portPairGroup.portPairGroupId(), portPairGroup);
    if (!portPairGroupStore.containsKey(portPairGroup.portPairGroupId())) {
        log.debug("The portPairGroup is created failed which identifier was {}", portPairGroup.portPairGroupId()
                .toString());
        return false;
    }
    return true;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:PortPairGroupManager.java


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