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


Java PortChain类代码示例

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


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

示例1: process

import org.onosproject.vtnrsc.PortChain; //导入依赖的package包/类
@Override
public void process(long sid, ObjectNode payload) {
    String mode = string(payload, MODE);
    PortChainService pcs = get(PortChainService.class);
    Iterable<PortChain> portChains = pcs.getPortChains();
    ObjectNode result = objectNode();

    ArrayNode arrayNode = arrayNode();

    for (final PortChain portChain : portChains) {
        arrayNode.add(portChain.portChainId().value().toString());
    }
    result.putArray("a").addAll(arrayNode);

    sendMessage(SAMPLE_TOPOV_DISPLAY_SFC, sid, result);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:SfcwebUiTopovMessageHandler.java

示例2: getServiceFunctions

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

示例3: activate

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

    eventDispatcher.addSink(PortChainEvent.class, listenerRegistry);

    KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
            .register(KryoNamespaces.API)
            .register(MultiValuedTimestamp.class)
            .register(PortChain.class, PortChainId.class, UUID.class, PortPairGroupId.class,
                      FlowClassifierId.class, FiveTuple.class, LoadBalanceId.class, DeviceId.class,
                      DefaultPortChain.class, PortPairId.class, TenantId.class);

    portChainStore = storageService
            .<PortChainId, PortChain>eventuallyConsistentMapBuilder()
            .withName("portchainstore").withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp()).build();

    portChainStore.addListener(portChainListener);

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

示例4: updatePortChain

import org.onosproject.vtnrsc.PortChain; //导入依赖的package包/类
@Override
public boolean updatePortChain(PortChain portChain) {
    checkNotNull(portChain, PORT_CHAIN_NULL);
    PortChain oldPortChain = null;
    if (!portChainStore.containsKey(portChain.portChainId())) {
        log.warn("The portChain is not exist whose identifier was {} ",
                 portChain.portChainId().toString());
        return false;
    } else {
        oldPortChain = portChainStore.get(portChain.portChainId());
    }
    PortChain newPortChain = DefaultPortChain.create(portChain, oldPortChain);
    portChainStore.put(newPortChain.portChainId(), newPortChain);

    if (!newPortChain.equals(portChainStore.get(newPortChain.portChainId()))) {
        log.debug("The portChain is updated failed whose identifier was {} ",
                  newPortChain.portChainId().toString());
        return false;
    }
    return true;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:PortChainManager.java

示例5: createPortChain

import org.onosproject.vtnrsc.PortChain; //导入依赖的package包/类
/**
 * Creates a new port chain.
 *
 * @param stream port chain 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 createPortChain(InputStream stream) {
    try {
        ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
        JsonNode port = jsonTree.get("port_chain");
        PortChain portChain = codec(PortChain.class).decode((ObjectNode) port, this);
        Boolean issuccess = nullIsNotFound(get(PortChainService.class).createPortChain(portChain),
                                           PORT_CHAIN_NOT_FOUND);
        return Response.status(OK).entity(issuccess.toString()).build();
    } catch (IOException e) {
        log.error("Exception while creating port chain {}.", e.toString());
        throw new IllegalArgumentException(e);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:PortChainWebResource.java

示例6: updatePortPain

import org.onosproject.vtnrsc.PortChain; //导入依赖的package包/类
/**
 * Update details of a specified port chain id.
 *
 * @param id port chain id
 * @param stream port chain json
 * @return 200 OK, 404 if given identifier does not exist
 */
@PUT
@Path("{chain_id}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response updatePortPain(@PathParam("chain_id") String id,
                               final InputStream stream) {
    try {
        ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
        JsonNode port = jsonTree.get("port_chain");
        PortChain portChain = codec(PortChain.class).decode((ObjectNode) port, this);
        Boolean result = nullIsNotFound(get(PortChainService.class).updatePortChain(portChain),
                                        PORT_CHAIN_NOT_FOUND);
        return Response.status(OK).entity(result.toString()).build();
    } catch (IOException e) {
        log.error("Update port chain failed because of exception {}.", e.toString());
        throw new IllegalArgumentException(e);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:PortChainWebResource.java

示例7: sfcPorts

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

示例8: codecPortChainTest

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

    PortChain portChain = getPortChain("portChain.json");

    assertThat(portChain, notNullValue());

    PortChainId portChainId = PortChainId.of("1278dcd4-459f-62ed-754b-87fc5e4a6751");
    TenantId tenantId = TenantId.tenantId("d382007aa9904763a801f68ecf065cf5");

    assertThat(portChain.portChainId().toString(), is(portChainId.toString()));
    assertThat(portChain.name(), is("PC2"));
    assertThat(portChain.tenantId().toString(), is(tenantId.toString()));
    assertThat(portChain.description(), is("Two flows and two port-pair-groups"));

    assertThat(portChain.flowClassifiers(), notNullValue());
    assertThat(portChain.portPairGroups(), notNullValue());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:PortChainCodecTest.java

示例9: testGetPortChainId

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

    final Set<PortChain> portChains = new HashSet<>();
    portChains.add(portChain1);

    expect(portChainService.exists(anyObject())).andReturn(true).anyTimes();
    expect(portChainService.getPortChain(anyObject())).andReturn(portChain1).anyTimes();
    replay(portChainService);

    final WebTarget wt = target();
    final String response = wt.path("port_chains/1278dcd4-459f-62ed-754b-87fc5e4a6751")
            .request().get(String.class);
    final JsonObject result = Json.parse(response).asObject();
    assertThat(result, notNullValue());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:PortChainResourceTest.java

示例10: installFlowClassifier

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

示例11: unInstallFlowClassifier

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

示例12: createPortChain

import org.onosproject.vtnrsc.PortChain; //导入依赖的package包/类
private PortChain createPortChain() {

        portPairGroups.clear();
        flowClassifiers.clear();
        // create list of Port Pair Groups.

        portPairGroups.add(portPairGroupId1);
        portPairGroups.add(portPairGroupId2);
        // create list of Flow classifiers.
        flowClassifiers.add(flowClassifierId1);
        flowClassifiers.add(flowClassifierId2);

        DefaultPortChain.Builder portChainBuilder = new DefaultPortChain.Builder();
        final PortChain portChain = portChainBuilder.setId(portChainId).setTenantId(tenantId).setName(name)
                .setDescription(description).setPortPairGroups(portPairGroups).setFlowClassifiers(flowClassifiers)
                .build();

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

示例13: process

import org.onosproject.vtnrsc.PortChain; //导入依赖的package包/类
@Override
public void process(ObjectNode payload) {
    String mode = string(payload, MODE);
    PortChainService pcs = get(PortChainService.class);
    Iterable<PortChain> portChains = pcs.getPortChains();
    ObjectNode result = objectNode();

    ArrayNode arrayNode = arrayNode();

    for (final PortChain portChain : portChains) {
        arrayNode.add(portChain.portChainId().value().toString());
    }
    result.putArray("a").addAll(arrayNode);

    sendMessage(SAMPLE_TOPOV_DISPLAY_SFC, result);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:17,代码来源:SfcwebUiTopovMessageHandler.java

示例14: sfcPorts

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

示例15: VtnRscEventFeedback

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


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