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


Java PortNumber.portNumber方法代码示例

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


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

示例1: decode

import org.onosproject.net.PortNumber; //导入方法依赖的package包/类
@Override
public NiciraResubmitTable decode(ObjectNode json, CodecContext context) {
    if (json == null || !json.isObject()) {
        return null;
    }

    // parse in port number
    long portNumberLong = nullIsIllegal(json.get(RESUBMIT_PORT),
            RESUBMIT_PORT + MISSING_MEMBER_MESSAGE).asLong();
    PortNumber portNumber = PortNumber.portNumber(portNumberLong);

    // parse table id
    short tableId = (short) nullIsIllegal(json.get(RESUBMIT_TABLE),
            RESUBMIT_TABLE + MISSING_MEMBER_MESSAGE).asInt();

    return new NiciraResubmitTable(portNumber, tableId);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:NiciraResubmitTableCodec.java

示例2: addLink

import org.onosproject.net.PortNumber; //导入方法依赖的package包/类
/**
 * Returns link for two devices.
 *
 * @param device source device
 * @param port source port
 * @param device2 destination device
 * @param port2 destination port
 * @return link
 */
public static Link addLink(String device, long port, String device2, long port2, boolean setCost, int value) {
    ConnectPoint src = new ConnectPoint(DeviceId.deviceId(device), PortNumber.portNumber(port));
    ConnectPoint dst = new ConnectPoint(DeviceId.deviceId(device2), PortNumber.portNumber(port2));
    Link curLink;
    DefaultAnnotations.Builder annotationBuilder = DefaultAnnotations.builder();
    if (setCost) {
        annotationBuilder.set(ANNOTATION_COST, String.valueOf(value));
    } else {
        annotationBuilder.set(ANNOTATION_TE_COST, String.valueOf(value));
    }

    //TODO:If cost not set cost : default value case
    curLink = DefaultLink.builder().src(src).dst(dst).state(ACTIVE).type(DIRECT)
             .providerId(PathComputationTest.providerId).annotations(annotationBuilder.build()).build();
    return curLink;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:PathComputationTest.java

示例3: createLinks

import org.onosproject.net.PortNumber; //导入方法依赖的package包/类
/**
 * Creates the links for the fake topology.
 * NB: Only unidirectional links are created, as for this purpose all we
 * need is to occupy the ports with some link.
 */
private void createLinks(int numDevices) {
    List<Link> links = new ArrayList<>();

    for (int i = 1; i <= numDevices; i++) {
        ConnectPoint src = new ConnectPoint(
                getDeviceId(i),
                PortNumber.portNumber(2));
        ConnectPoint dst = new ConnectPoint(
                getDeviceId((i + 1 > numDevices) ? 1 : i + 1),
                PortNumber.portNumber(3));

        Link link = createMock(Link.class);
        expect(link.src()).andReturn(src).anyTimes();
        expect(link.dst()).andReturn(dst).anyTimes();
        replay(link);

        links.add(link);
    }

    expect(linkService.getLinks()).andReturn(links).anyTimes();
    replay(linkService);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:ProxyArpManagerTest.java

示例4: testEquality

import org.onosproject.net.PortNumber; //导入方法依赖的package包/类
@Test
public void testEquality() {
    DefaultVirtualDevice device1 =
            new DefaultVirtualDevice(NetworkId.networkId(0), DeviceId.deviceId(deviceIdValue1));
    DefaultVirtualDevice device2 =
            new DefaultVirtualDevice(NetworkId.networkId(0), DeviceId.deviceId(deviceIdValue2));

    Port portA = new DefaultPort(device1, PortNumber.portNumber(1), true);
    Port portB = new DefaultPort(device1, PortNumber.portNumber(2), true);
    Port portC = new DefaultPort(device2, PortNumber.portNumber(2), true);

    DefaultVirtualPort port1 =
            new DefaultVirtualPort(NetworkId.networkId(0), device1, PortNumber.portNumber(1), portA);
    DefaultVirtualPort port2 =
            new DefaultVirtualPort(NetworkId.networkId(0), device1, PortNumber.portNumber(1), portA);
    DefaultVirtualPort port3 =
            new DefaultVirtualPort(NetworkId.networkId(0), device1, PortNumber.portNumber(2), portB);
    DefaultVirtualPort port4 =
            new DefaultVirtualPort(NetworkId.networkId(1), device2, PortNumber.portNumber(2), portC);


    new EqualsTester().addEqualityGroup(port1, port2).addEqualityGroup(port3)
            .addEqualityGroup(port4).testEquals();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:DefaultVirtualPortTest.java

示例5: testConstruction

import org.onosproject.net.PortNumber; //导入方法依赖的package包/类
/**
 * Checks the construction of a DefaultLspLocalLabelInfo object.
 */
@Test
public void testConstruction() {
    DeviceId deviceId = DeviceId.deviceId("foo");
    LabelResourceId inLabelId = LabelResourceId.labelResourceId(1);
    LabelResourceId outLabelId = LabelResourceId.labelResourceId(2);
    PortNumber inPort = PortNumber.portNumber(5122);
    PortNumber outPort = PortNumber.portNumber(5123);

    LspLocalLabelInfo lspLocalLabel = DefaultLspLocalLabelInfo.builder()
            .deviceId(deviceId)
            .inLabelId(inLabelId)
            .outLabelId(outLabelId)
            .inPort(inPort)
            .outPort(outPort)
            .build();

    assertThat(deviceId, is(lspLocalLabel.deviceId()));
    assertThat(inLabelId, is(lspLocalLabel.inLabelId()));
    assertThat(outLabelId, is(lspLocalLabel.outLabelId()));
    assertThat(inPort, is(lspLocalLabel.inPort()));
    assertThat(outPort, is(lspLocalLabel.outPort()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:DefaultLspLocalLabelInfoTest.java

示例6: execute

import org.onosproject.net.PortNumber; //导入方法依赖的package包/类
@Override
protected void execute() {
    VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
    ConnectPoint src = new ConnectPoint(DeviceId.deviceId(srcDeviceId), PortNumber.portNumber(srcPortNum));
    ConnectPoint dst = new ConnectPoint(DeviceId.deviceId(dstDeviceId), PortNumber.portNumber(dstPortNum));

    service.createVirtualLink(NetworkId.networkId(networkId), src, dst);
    if (bidirectional) {
        service.createVirtualLink(NetworkId.networkId(networkId), dst, src);
    }
    print("Virtual link successfully created.");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:VirtualLinkCreateCommand.java

示例7: basicTests

import org.onosproject.net.PortNumber; //导入方法依赖的package包/类
@Test
public void basicTests() {
    PortNumber pn = PortNumber.portNumber(4900);
    Annotations annotations = DefaultAnnotations.builder()
                            .set("Base", "value")
                            .build();

    boolean isEnabled = true;
    Port base = new DefaultPort(DEV, pn, isEnabled, Port.Type.VIRTUAL, 2, annotations);
    Frequency minFrequency = Frequency.ofGHz(3);
    Frequency maxFrequency = Frequency.ofGHz(33);
    Frequency grid = Frequency.ofGHz(2);
    OmsPort oms = new DefaultOmsPort(base, minFrequency, maxFrequency, grid);

    // basic attributes and annotations are inherited from base
    assertThat(oms.element(), is(DEV));
    assertThat(oms.isEnabled(), is(isEnabled));
    assertThat(oms.number(), is(pn));
    assertThat(oms.annotations(), is(annotations));

    assertThat("type is always OMS", oms.type(), is(Port.Type.OMS));
    assertThat("port speed is undefined", oms.portSpeed(), is(equalTo(0L)));

    assertThat(oms.maxFrequency(), is(maxFrequency));
    assertThat(oms.minFrequency(), is(minFrequency));
    assertThat(oms.grid(), is(grid));
    assertThat("(33-3)/2 = 15", oms.totalChannels(), is((short) 15));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:29,代码来源:DefaultOmsPortTest.java

示例8: execute

import org.onosproject.net.PortNumber; //导入方法依赖的package包/类
@Override
protected void execute() {
    VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
    DeviceService deviceService = get(DeviceService.class);
    VirtualDevice virtualDevice = getVirtualDevice(DeviceId.deviceId(deviceId));
    checkNotNull(virtualDevice, "The virtual device does not exist.");

    DefaultAnnotations annotations = DefaultAnnotations.builder().build();
    Device physDevice = new DefaultDevice(null, DeviceId.deviceId(physDeviceId),
                                          null, null, null, null, null, null, annotations);
    Port realizedBy = new DefaultPort(physDevice, PortNumber.portNumber(physPortNum), true);
    service.createVirtualPort(NetworkId.networkId(networkId), DeviceId.deviceId(deviceId),
                              PortNumber.portNumber(portNum), realizedBy);
    print("Virtual port successfully created.");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:VirtualPortCreateCommand.java

示例9: parseT100OduPort

import org.onosproject.net.PortNumber; //导入方法依赖的package包/类
private static PortDescription parseT100OduPort(HierarchicalConfiguration cfg, long count) {
    PortNumber portNumber = PortNumber.portNumber(count);
    HierarchicalConfiguration ethernetConfig = cfg.configurationAt("ethernet");
    boolean enabled = ethernetConfig.getString("administrative-state").equals("up");
    //Rate is in kbps
    CltSignalType signalType = ethernetConfig.getString("rate").equals("100000000") ?
            CltSignalType.CLT_100GBE : null;
    DefaultAnnotations annotations = DefaultAnnotations.builder().
            set(AnnotationKeys.PORT_NAME, cfg.getString("name")).
            build();
    return oduCltPortDescription(portNumber, enabled, signalType, annotations);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:PortGetterFujitsuImpl.java

示例10: testBuilderNullNetworkId

import org.onosproject.net.PortNumber; //导入方法依赖的package包/类
/**
 * Tests the DefaultVirtualLink Builder to ensure that the networkId cannot be null.
 */
@Test(expected = NullPointerException.class)
public void testBuilderNullNetworkId() {
    DefaultVirtualDevice device1 =
            new DefaultVirtualDevice(NetworkId.networkId(0), DeviceId.deviceId(deviceIdValue1));
    DefaultVirtualDevice device2 =
            new DefaultVirtualDevice(NetworkId.networkId(0), DeviceId.deviceId(deviceIdValue2));
    ConnectPoint src = new ConnectPoint(device1.id(), PortNumber.portNumber(1));
    ConnectPoint dst = new ConnectPoint(device2.id(), PortNumber.portNumber(2));

    DefaultVirtualLink.builder()
            .networkId(null)
            .build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:DefaultVirtualLinkTest.java

示例11: testCreateTunnelNullDst

import org.onosproject.net.PortNumber; //导入方法依赖的package包/类
/**
 * Test a null destination connect point.
 */
@Test(expected = NullPointerException.class)
public void testCreateTunnelNullDst() {
    ConnectPoint src = new ConnectPoint(DeviceId.deviceId("device1"), PortNumber.portNumber(1));

    provider.createTunnel(NetworkId.networkId(0), src, null);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:PtToPtIntentVirtualNetworkProviderTest.java

示例12: testBuilderNullSrc

import org.onosproject.net.PortNumber; //导入方法依赖的package包/类
/**
 * Tests the DefaultVirtualLink Builder to ensure that the src cannot be null.
 */
@Test(expected = NullPointerException.class)
public void testBuilderNullSrc() {
    DefaultVirtualDevice device1 =
            new DefaultVirtualDevice(NetworkId.networkId(0), DeviceId.deviceId(deviceIdValue1));
    DefaultVirtualDevice device2 =
            new DefaultVirtualDevice(NetworkId.networkId(0), DeviceId.deviceId(deviceIdValue2));
    ConnectPoint src = new ConnectPoint(device1.id(), PortNumber.portNumber(1));
    ConnectPoint dst = new ConnectPoint(device2.id(), PortNumber.portNumber(2));

    DefaultVirtualLink.builder()
            .src(null)
            .build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:DefaultVirtualLinkTest.java

示例13: buildPortDescription

import org.onosproject.net.PortNumber; //导入方法依赖的package包/类
private PortDescription buildPortDescription(OFPortStatus status) {
    OFPortDesc port = status.getDesc();
    if (status.getReason() != OFPortReason.DELETE) {
        return buildPortDescription(port);
    } else {
        PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber());
        Port.Type type = port.getCurr().contains(OFPortFeatures.PF_FIBER) ? FIBER : COPPER;
        SparseAnnotations annotations = makePortAnnotation(port.getName(), port.getHwAddr().toString());
        return new DefaultPortDescription(portNo, false, type,
                portSpeed(port), annotations);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:OpenFlowDeviceProvider.java

示例14: withTime

import org.onosproject.net.PortNumber; //导入方法依赖的package包/类
@Override
@Test
public void withTime() {
    Device device = createDevice();
    Port port = new DefaultPort(device, PortNumber.portNumber(123), true);
    DeviceEvent event = new DeviceEvent(DeviceEvent.Type.DEVICE_ADDED,
            device, port, 123L);
    validateEvent(event, DeviceEvent.Type.DEVICE_ADDED, device, 123L);
    assertEquals("incorrect port", port, event.port());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:DeviceEventTest.java

示例15: buildLinkDes

import org.onosproject.net.PortNumber; //导入方法依赖的package包/类
/**
 * Builds link description.
 *
 * @param isisLink ISIS link instance
 * @return link description
 */
private LinkDescription buildLinkDes(IsisLink isisLink) {
    long srcAddress = 0;
    long dstAddress = 0;
    boolean localPseduo = false;
    boolean remotePseduo = false;
    String localSystemId = isisLink.localSystemId();
    String remoteSystemId = isisLink.remoteSystemId();
    //Changing of port numbers
    if (isisLink.interfaceIp() != null) {
        //srcAddress = isisLink.interfaceIp().toInt();
        srcAddress = (long) Long.parseUnsignedLong(Integer.toBinaryString(isisLink.interfaceIp().toInt()), 2);
    }
    if (isisLink.neighborIp() != null) {
        //dstAddress = isisLink.neighborIp().toInt();
        dstAddress = (long) Long.parseUnsignedLong(Integer.toBinaryString(isisLink.neighborIp().toInt()), 2);
    }
    DeviceId srcId = DeviceId.deviceId(IsisRouterId.uri(localSystemId));
    DeviceId dstId = DeviceId.deviceId(IsisRouterId.uri(remoteSystemId));
    if (checkIsDis(isisLink.localSystemId())) {
        localPseduo = true;
    } else if (checkIsDis(isisLink.remoteSystemId())) {
        remotePseduo = true;
    } else {
        log.debug("IsisDeviceProvider::buildLinkDes : unknown type.!");
    }

    if (localPseduo && srcAddress == 0) {
        srcAddress = PSEUDO_PORT;
    } else if (remotePseduo && dstAddress == 0) {
        dstAddress = PSEUDO_PORT;
    }

    ConnectPoint src = new ConnectPoint(srcId, PortNumber.portNumber(srcAddress));
    ConnectPoint dst = new ConnectPoint(dstId, PortNumber.portNumber(dstAddress));
    DefaultAnnotations.Builder annotationBuilder = DefaultAnnotations.builder();
    if (isisLink != null) {
        annotationBuilder = buildAnnotations(annotationBuilder, isisLink);
    }

    return new DefaultLinkDescription(src, dst, Link.Type.DIRECT, false, annotationBuilder.build());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:48,代码来源:IsisTopologyProvider.java


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