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


Java PortPair类代码示例

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


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

示例1: modifyHostDetails

import org.onosproject.vtnrsc.PortPair; //导入依赖的package包/类
@Override
public void modifyHostDetails(PropertyPanel pp, HostId hostId) {
    pp.title(MY_HOST_TITLE);
    pp.removeAllProps();
    PortPairService portPairService = AbstractShellCommand.get(PortPairService.class);
    VirtualPortService virtualPortService = AbstractShellCommand.get(VirtualPortService.class);
    HostService hostService = AbstractShellCommand.get(HostService.class);
    Iterable<PortPair> portPairs = portPairService.getPortPairs();
    for (PortPair portPair : portPairs) {
        VirtualPort vPort = virtualPortService.getPort(VirtualPortId.portId(portPair.ingress()));
        MacAddress dstMacAddress = vPort.macAddress();
        Host host = hostService.getHost(HostId.hostId(dstMacAddress));
        if (hostId.toString().equals(host.id().toString())) {
            pp.addProp("SF Name", portPair.name());
            pp.addProp("SF Ip", vPort.fixedIps().iterator().next().ip());
        }
    }
    pp.addProp("SF host Address", hostId.toString());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:SfcwebUiTopovOverlay.java

示例2: activate

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

    eventDispatcher.addSink(PortPairEvent.class, listenerRegistry);
    KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
            .register(KryoNamespaces.API)
            .register(MultiValuedTimestamp.class)
            .register(PortPair.class, PortPairId.class, UUID.class, DefaultPortPair.class, TenantId.class);

    portPairStore = storageService.<PortPairId, PortPair>eventuallyConsistentMapBuilder()
            .withName("portpairstore")
            .withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .build();

    portPairStore.addListener(portPairListener);

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

示例3: updatePortPair

import org.onosproject.vtnrsc.PortPair; //导入依赖的package包/类
@Override
public boolean updatePortPair(PortPair portPair) {
    checkNotNull(portPair, PORT_PAIR_NULL);

    if (!portPairStore.containsKey(portPair.portPairId())) {
        log.debug("The portPair is not exist whose identifier was {} ", portPair.portPairId().toString());
        return false;
    }

    portPairStore.put(portPair.portPairId(), portPair);

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

示例4: createPortPair

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

示例5: updatePortPair

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

示例6: sfcPorts

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

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

    PortPair portPair = getPortPair("portPair.json");

    assertThat(portPair, notNullValue());

    PortPairId portPairId = PortPairId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
    TenantId tenantId = TenantId.tenantId("d382007aa9904763a801f68ecf065cf5");

    assertThat(portPair.portPairId().toString(), is(portPairId.toString()));
    assertThat(portPair.name(), is("PP1"));
    assertThat(portPair.tenantId().toString(), is(tenantId.toString()));
    assertThat(portPair.description(), is("SF-A"));
    assertThat(portPair.ingress().toString(), is("dace4513-24fc-4fae-af4b-321c5e2eb3d1"));
    assertThat(portPair.egress().toString(), is("aef3478a-4a56-2a6e-cd3a-9dee4e2ec345"));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:PortPairCodecTest.java

示例8: testGetPortPairId

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

    final Set<PortPair> portPairs = new HashSet<>();
    portPairs.add(portPair1);

    expect(portPairService.exists(anyObject())).andReturn(true).anyTimes();
    expect(portPairService.getPortPair(anyObject())).andReturn(portPair1).anyTimes();
    replay(portPairService);

    final WebTarget wt = target();
    final String response = wt.path("port_pairs/78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae")
            .request().get(String.class);
    final JsonObject result = Json.parse(response).asObject();
    assertThat(result, notNullValue());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:PortPairResourceTest.java

示例9: installFlowClassifier

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

import org.onosproject.vtnrsc.PortPair; //导入依赖的package包/类
/**
 * Checks the operation of onPortPairCreated() method.
 */
@Test
public void testOnPortPairCreated() {
    final PortPairId portPairId = PortPairId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
    final TenantId tenantId = TenantId.tenantId("1");
    final String name = "PortPair";
    final String description = "PortPair";
    final String ingress = "d3333333-24fc-4fae-af4b-321c5e2eb3d1";
    final String egress = "a4444444-4a56-2a6e-cd3a-9dee4e2ec345";
    DefaultPortPair.Builder portPairBuilder = new DefaultPortPair.Builder();
    PortPair portPair = null;
    SfcService sfcService = new SfcManager();

    // create port pair
    portPair = portPairBuilder.setId(portPairId).setTenantId(tenantId).setName(name).setDescription(description)
            .setIngress(ingress).setEgress(egress).build();
    sfcService.onPortPairCreated(portPair);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:SfcManagerTest.java

示例12: testOnPortPairDeleted

import org.onosproject.vtnrsc.PortPair; //导入依赖的package包/类
/**
 * Checks the operation of onPortPairDeleted() method.
 */
@Test
public void testOnPortPairDeleted() {
    final PortPairId portPairId = PortPairId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
    final TenantId tenantId = TenantId.tenantId("1");
    final String name = "PortPair";
    final String description = "PortPair";
    final String ingress = "d3333333-24fc-4fae-af4b-321c5e2eb3d1";
    final String egress = "a4444444-4a56-2a6e-cd3a-9dee4e2ec345";
    DefaultPortPair.Builder portPairBuilder = new DefaultPortPair.Builder();
    PortPair portPair = null;
    SfcService sfcService = new SfcManager();

    // create port pair
    portPair = portPairBuilder.setId(portPairId).setTenantId(tenantId).setName(name).setDescription(description)
            .setIngress(ingress).setEgress(egress).build();
    sfcService.onPortPairDeleted(portPair);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:SfcManagerTest.java

示例13: sfcPorts

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

示例15: createPortPair

import org.onosproject.vtnrsc.PortPair; //导入依赖的package包/类
@Override
public boolean createPortPair(PortPair portPair) {
    checkNotNull(portPair, PORT_PAIR_NULL);

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


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