當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。