• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java PortDescription类的典型用法和代码示例

java 1次浏览

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

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

示例1: testUpdatePortStatus

点赞 6

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Test
public final void testUpdatePortStatus() {
    putDevice(DID1, SW1);
    List<PortDescription> pds = Arrays.<PortDescription>asList(
            new DefaultPortDescription(P1, true)
            );
    deviceStore.updatePorts(PID, DID1, pds);

    Capture<InternalPortStatusEvent> message = new Capture<>();
    Capture<MessageSubject> subject = new Capture<>();
    Capture<Function<InternalPortStatusEvent, byte[]>> encoder = new Capture<>();

    resetCommunicatorExpectingSingleBroadcast(message, subject, encoder);
    final DefaultPortDescription desc = new DefaultPortDescription(P1, false);
    DeviceEvent event = deviceStore.updatePortStatus(PID, DID1, desc);
    assertEquals(PORT_UPDATED, event.type());
    assertDevice(DID1, SW1, event.subject());
    assertEquals(P1, event.port().number());
    assertFalse("Port is disabled", event.port().isEnabled());
    verify(clusterCommunicator);
    assertInternalPortStatusEvent(NID1, DID1, PID, desc, NO_ANNOTATION, message, subject, encoder);
    assertTrue(message.hasCaptured());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:24,
代码来源:GossipDeviceStoreTest.java

示例2: parseWaveServerCienaOchPorts

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
public static PortDescription parseWaveServerCienaOchPorts(long portNumber, long oduPortSpeed,
                                                           HierarchicalConfiguration config,
                                                           SparseAnnotations annotations) {
    final List<String> tunableType = Lists.newArrayList("Performance-Optimized", "Accelerated");
    final String transmitterPath = "ptp-config.transmitter-state";
    final String tunablePath = "ptp-config.adv-config.tx-tuning-mode";
    final String gridTypePath = "ptp-config.adv-config.wl-spacing";
    final String frequencyPath = "ptp-config.adv-config.frequency";

    boolean isEnabled = config.getString(transmitterPath).equals("enabled");
    boolean isTunable = tunableType.contains(config.getString(tunablePath));

    //FIXME change when all optical types have two way information methods, see jira tickets
    final int speed100GbpsinMbps = 100000;
    OduSignalType oduSignalType = oduPortSpeed == speed100GbpsinMbps ? OduSignalType.ODU4 : null;
    GridType gridType = config.getString(gridTypePath).equals("FlexGrid") ? GridType.FLEX : null;
    ChannelSpacing chSpacing = gridType == GridType.FLEX ? ChannelSpacing.CHL_6P25GHZ : null;

    //Working in Ghz //(Nominal central frequency - 193.1)/channelSpacing = spacingMultiplier
    final int baseFrequency = 193100;
    int spacingMult = (int) (toGbps((Integer.parseInt(config.getString(frequencyPath)) -
            baseFrequency)) / toGbpsFromHz(chSpacing.frequency().asHz())); //FIXME is there a better way ?

    return ochPortDescription(PortNumber.portNumber(portNumber), isEnabled, oduSignalType, isTunable,
                                  new OchSignal(gridType, chSpacing, spacingMult, 1), annotations);
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:27,
代码来源:PortDiscoveryCienaWaveserverImpl.java

示例3: parseFujitsuT100Ports

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
/**
 * Parses a configuration and returns a set of ports for the fujitsu T100.
 * @param cfg a hierarchical configuration
 * @return a list of port descriptions
 */
private static List<PortDescription> parseFujitsuT100Ports(HierarchicalConfiguration cfg) {
    AtomicInteger counter = new AtomicInteger(1);
    List<PortDescription> portDescriptions = Lists.newArrayList();
    List<HierarchicalConfiguration> subtrees =
            cfg.configurationsAt("data.interfaces.interface");
    for (HierarchicalConfiguration portConfig : subtrees) {
        if (!portConfig.getString("name").contains("LCN") &&
                !portConfig.getString("name").contains("LMP") &&
                portConfig.getString("type").equals("ianaift:ethernetCsmacd")) {
            portDescriptions.add(parseT100OduPort(portConfig, counter.getAndIncrement()));
        } else if (portConfig.getString("type").equals("ianaift:otnOtu")) {
            portDescriptions.add(parseT100OchPort(portConfig, counter.getAndIncrement()));
        }
    }
    return portDescriptions;
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:22,
代码来源:PortGetterFujitsuImpl.java

示例4: handle

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Override
public void handle(ClusterMessage message) {

    log.debug("Received port update event from peer: {}", message.sender());
    InternalPortEvent event = SERIALIZER.decode(message.payload());

    ProviderId providerId = event.providerId();
    DeviceId deviceId = event.deviceId();
    Timestamped<List<PortDescription>> portDescriptions = event.portDescriptions();

    if (getDevice(deviceId) == null) {
        log.debug("{} not found on this node yet, ignoring.", deviceId);
        // Note: dropped information will be recovered by anti-entropy
        return;
    }

    try {
        notifyDelegate(updatePortsInternal(providerId, deviceId, portDescriptions));
    } catch (Exception e) {
        log.warn("Exception thrown handling port update", e);
    }
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:23,
代码来源:GossipDeviceStore.java

示例5: addLink

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Override
public void addLink(OspfRouter ospfRouter, OspfLinkTed ospfLinkTed) {
    log.debug("Addlink {}", ospfRouter.routerIp());
    LinkDescription linkDes = buildLinkDes(ospfRouter, ospfLinkTed);
    //If already link exists, return
    if (linkService.getLink(linkDes.src(), linkDes.dst()) != null || linkProviderService == null) {
        return;
    }
    //Updating ports of the link
    List<PortDescription> srcPortDescriptions = new LinkedList<>();
    srcPortDescriptions.add(new DefaultPortDescription(linkDes.src().port(), true));
    deviceProviderService.updatePorts(linkDes.src().deviceId(), srcPortDescriptions);

    List<PortDescription> dstPortDescriptions = new LinkedList<>();
    dstPortDescriptions.add(new DefaultPortDescription(linkDes.dst().port(), true));
    deviceProviderService.updatePorts(linkDes.dst().deviceId(), dstPortDescriptions);
    linkProviderService.linkDetected(linkDes);
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:19,
代码来源:OspfTopologyProvider.java

示例6: deleteLink

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Override
public void deleteLink(OspfRouter ospfRouter, OspfLinkTed ospfLinkTed) {
    log.debug("Delete link {}", ospfRouter.routerIp().toString());
    if (linkProviderService == null) {
        return;
    }
    LinkDescription linkDes = buildLinkDes(ospfRouter, ospfLinkTed);
    //Updating ports of the link
    List<PortDescription> srcPortDescriptions = new LinkedList<>();
    srcPortDescriptions.add(new DefaultPortDescription(linkDes.src().port(), true));
    deviceProviderService.updatePorts(linkDes.src().deviceId(), srcPortDescriptions);

    List<PortDescription> dstPortDescriptions = new LinkedList<>();
    dstPortDescriptions.add(new DefaultPortDescription(linkDes.dst().port(), true));
    deviceProviderService.updatePorts(linkDes.dst().deviceId(), dstPortDescriptions);
    linkProviderService.linkVanished(linkDes);
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:18,
代码来源:OspfTopologyProvider.java

示例7: buildPortDescription

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
/**
 * Build a portDescription from a given port description describing a fiber switch optical port.
 *
 * @param port description property type.
 * @param port the port to build from.
 * @return portDescription for the port.
 */
private PortDescription buildPortDescription(OFCalientPortDescStatsEntry port) {
    PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber());

    // Use the alias name if it's available
    String name = port.getName();
    List<OFCalientPortDescProp> props = port.getProperties();
    if (props != null && props.size() > 0) {
        OFCalientPortDescPropOptical propOptical = (OFCalientPortDescPropOptical) props.get(0);
        if (propOptical != null) {
            name = propOptical.getInAlias();
        }
    }

    // FIXME when Calient OF agent reports port status
    boolean enabled = true;
    SparseAnnotations annotations = makePortAnnotation(name, port.getHwAddr().toString());

    // S160 data sheet
    // Wavelength range: 1260 - 1630 nm, grid is irrelevant for this type of switch
    return omsPortDescription(portNo, enabled,
            Spectrum.U_BAND_MIN, Spectrum.O_BAND_MAX, Frequency.ofGHz(100), annotations);
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:30,
代码来源:OpenFlowDeviceProvider.java

示例8: testGetPort

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Test
public final void testGetPort() {
    putDevice(DID1, SW1);
    putDevice(DID2, SW1);
    List<PortDescription> pds = Arrays.<PortDescription>asList(
            new DefaultPortDescription(P1, true),
            new DefaultPortDescription(P2, false)
            );
    deviceStore.updatePorts(PID, DID1, pds);

    Port port1 = deviceStore.getPort(DID1, P1);
    assertEquals(P1, port1.number());
    assertTrue("Port is enabled", port1.isEnabled());

    Port port2 = deviceStore.getPort(DID1, P2);
    assertEquals(P2, port2.number());
    assertFalse("Port is disabled", port2.isEnabled());

    Port port3 = deviceStore.getPort(DID1, P3);
    assertNull("P3 not expected", port3);
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:22,
代码来源:GossipDeviceStoreTest.java

示例9: buildPortDescriptions

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
private List<PortDescription> buildPortDescriptions(PcepDpid dpid,
                                                    Port port,
                                                    PortType portType) {

    List<PortDescription> portList;

    if (portMap.containsKey(dpid.value())) {
        portList = portMap.get(dpid.value());
    } else {
        portList = new ArrayList<>();
    }
    if (port != null && portType != null) {
        portList.add(buildPortDescription(port, portType));
    }

    portMap.put(dpid.value(), portList);
    return portList;
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:19,
代码来源:PcepTopologyProvider.java

示例10: buildPortDescriptions

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
/**
 * Builds port description.
 *
 * @param deviceId   device ID for the port
 * @param portNumber port number of the link
 * @return list of port description
 */
private List<PortDescription> buildPortDescriptions(DeviceId deviceId,
                                                    PortNumber portNumber) {
    List<PortDescription> portList;
    if (portMap.containsKey(deviceId)) {
        portList = portMap.get(deviceId);
    } else {
        portList = new ArrayList<>();
    }
    if (portNumber != null) {
        PortDescription portDescriptions = new DefaultPortDescription(portNumber, true);
        portList.add(portDescriptions);
    }
    portMap.put(deviceId, portList);

    return portList;
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:24,
代码来源:IsisTopologyProvider.java

示例11: buildPortDescriptions

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
private List<PortDescription> buildPortDescriptions(DeviceId deviceId,
                                                    PortNumber portNumber) {

    List<PortDescription> portList;

    if (portMap.containsKey(deviceId)) {
        portList = portMap.get(deviceId);
    } else {
        portList = new ArrayList<>();
    }
    if (portNumber != null) {
        PortDescription portDescriptions = new DefaultPortDescription(portNumber, true);
        portList.add(portDescriptions);
    }

    portMap.put(deviceId, portList);
    return portList;
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:19,
代码来源:BgpTopologyProvider.java

示例12: updatePortsAndStats

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
private void updatePortsAndStats(DeviceId did) {
    Device device = deviceService.getDevice(did);
    if (device.is(DeviceDescriptionDiscovery.class)) {
        DeviceDescriptionDiscovery discovery = device.as(DeviceDescriptionDiscovery.class);
        List<PortDescription> portDescriptions = discovery.discoverPortDetails();
        if (portDescriptions != null) {
            providerService.updatePorts(did, portDescriptions);
        }
    } else {
        log.warn("No DeviceDescriptionDiscovery behavior for device {}", did);
    }
    try {
        Collection<PortStatistics> portStats = getPortStatistics(controller.getAgent(did),
                                                                 deviceService.getPorts(did));
        providerService.updatePortStatistics(did, portStats);
    } catch (Bmv2RuntimeException e) {
        log.warn("Unable to get port statistics for {}: {}", did, e.explain());
    }
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:20,
代码来源:Bmv2DeviceProvider.java

示例13: updatePorts

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Override
public void updatePorts(DeviceId deviceId,
                        List<PortDescription> portDescriptions) {
    checkValidity();

    DeviceProviderServiceMsg.Builder builder = DeviceProviderServiceMsg.newBuilder();
    List<org.onosproject.grpc.net.Port.PortDescription> portDescs =
            portDescriptions.stream()
                .map(GrpcDeviceUtils::translate)
                .collect(toList());

    builder.setUpdatePorts(builder.getUpdatePortsBuilder()
                           .setDeviceId(deviceId.toString())
                           .addAllPortDescriptions(portDescs)
                           .build());

    devProvService.onNext(builder.build());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:19,
代码来源:DeviceProviderServiceClientProxy.java

示例14: otuPortDescription

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
/**
 * Creates OTU port description based on the supplied information.
 *
 * @param number        port number
 * @param isEnabled     port enabled state
 * @param signalType    OTU client signal type
 * @param annotations   key/value annotations map
 */
public static PortDescription otuPortDescription(PortNumber number,
                                                 boolean isEnabled,
                                                 OtuSignalType signalType,
                                                 SparseAnnotations annotations) {
    Builder builder = DefaultAnnotations.builder();
    builder.putAll(annotations);

    builder.set(SIGNAL_TYPE, signalType.toString());

    long portSpeed = 0; // TODO specify appropriate value?
    return new DefaultPortDescription(number,
                                      isEnabled,
                                      Port.Type.OTU,
                                      portSpeed,
                                      builder.build());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:25,
代码来源:OtuPortHelper.java

示例15: oduCltPortDescription

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
/**
 * Creates ODU client port description based on the supplied information.
 *
 * @param number        port number
 * @param isEnabled     port enabled state
 * @param signalType    ODU client signal type
 * @param annotations   key/value annotations map
 */
public static PortDescription oduCltPortDescription(PortNumber number,
                                                    boolean isEnabled,
                                                    CltSignalType signalType,
                                                    SparseAnnotations annotations) {
    Builder builder = DefaultAnnotations.builder();
    builder.putAll(annotations);

    builder.set(SIGNAL_TYPE, signalType.toString());

    long portSpeed = signalType.bitRate();
    return new DefaultPortDescription(number,
                                      isEnabled,
                                      Port.Type.ODUCLT,
                                      portSpeed,
                                      builder.build());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:25,
代码来源:OduCltPortHelper.java

示例16: omsPortDescription

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
/**
 * Creates OMS port description based on the supplied information.
 *
 * @param number        port number
 * @param isEnabled     port enabled state
 * @param minFrequency  minimum frequency
 * @param maxFrequency  maximum frequency
 * @param grid          grid spacing frequency
 * @param annotations   key/value annotations map
 */
public static PortDescription omsPortDescription(PortNumber number,
                                          boolean isEnabled,
                                          Frequency minFrequency,
                                          Frequency maxFrequency,
                                          Frequency grid,
                                          SparseAnnotations annotations) {

    Builder builder = DefaultAnnotations.builder();
    builder.putAll(annotations);

    builder.set(MIN_FREQ_HZ, String.valueOf(minFrequency.asHz()));
    builder.set(MAX_FREQ_HZ, String.valueOf(maxFrequency.asHz()));
    builder.set(GRID_HZ, String.valueOf(grid.asHz()));

    long portSpeed = 0;
    return new DefaultPortDescription(number, isEnabled, Port.Type.OMS, portSpeed, builder.build());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:28,
代码来源:OmsPortHelper.java

示例17: ochPortDescription

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
/**
 * Creates OCh port DefaultPortDescription based on the supplied information.
 *
 * @param number      port number
 * @param isEnabled   port enabled state
 * @param signalType  ODU signal type
 * @param isTunable   tunable wavelength capability
 * @param lambda      OCh signal
 * @param annotationsIn key/value annotations map
 * @return OCh port DefaultPortDescription with OCh annotations
 */
public static PortDescription ochPortDescription(PortNumber number,
                                                 boolean isEnabled,
                                                 OduSignalType signalType,
                                                 boolean isTunable,
                                                 OchSignal lambda,
                                                 SparseAnnotations annotationsIn) {

    Builder builder = DefaultAnnotations.builder();
    builder.putAll(annotationsIn);

    builder.set(TUNABLE, String.valueOf(isTunable));
    builder.set(LAMBDA, OchSignalCodec.encode(lambda).toString());
    builder.set(SIGNAL_TYPE, signalType.toString());

    DefaultAnnotations annotations = builder.build();
    long portSpeed = 0; // FIXME assign appropriate value
    return new DefaultPortDescription(number, isEnabled, Port.Type.OCH, portSpeed, annotations);
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:30,
代码来源:OchPortHelper.java

示例18: testGetPorts

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Test
public final void testGetPorts() {
    putDevice(DID1, SW1);
    putDevice(DID2, SW1);
    List<PortDescription> pds = Arrays.<PortDescription>asList(
            new DefaultPortDescription(P1, true),
            new DefaultPortDescription(P2, true)
            );
    deviceStore.updatePorts(PID, DID1, pds);

    Set<PortNumber> expectedPorts = Sets.newHashSet(P1, P2);
    List<Port> ports = deviceStore.getPorts(DID1);
    for (Port port : ports) {
        assertTrue("Port is enabled", port.isEnabled());
        assertTrue("PortNumber is one of expected",
                expectedPorts.remove(port.number()));
    }
    assertTrue("Event for all expectedport appeared", expectedPorts.isEmpty());


    assertTrue("DID2 has no ports", deviceStore.getPorts(DID2).isEmpty());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:23,
代码来源:GossipDeviceStoreTest.java

示例19: testConfigPortName

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Test
public void testConfigPortName() {
    OPC.portType(Port.Type.ODUCLT)
        .portNumberName(PORT_NUMBER)
        .portName(CFG_PORT_NAME);

    PortDescription res;
    // full desc + opc with name
    res = OpticalPortOperator.combine(OPC, N_DESC);
    assertEquals("Configured port name expected",
                 CFG_PORT_NAME, res.portNumber().name());
    assertEquals(DESC_STATIC_PORT, res.annotations().value(AnnotationKeys.STATIC_PORT));

    res = OpticalPortOperator.combine(OPC, U_DESC);
    assertEquals("Configured port name expected",
                 CFG_PORT_NAME, res.portNumber().name());
    assertEquals(DESC_STATIC_PORT, res.annotations().value(AnnotationKeys.STATIC_PORT));
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:19,
代码来源:OpticalPortOperatorTest.java

示例20: updatePorts

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Test
public void updatePorts() {
    connectDevice(DID1, SW1);
    List<PortDescription> pds = new ArrayList<>();
    pds.add(new DefaultPortDescription(P1, true));
    pds.add(new DefaultPortDescription(P2, true));
    pds.add(new DefaultPortDescription(P3, true));
    providerService.updatePorts(DID1, pds);
    validateEvents(DEVICE_ADDED, PORT_ADDED, PORT_ADDED, PORT_ADDED);
    pds.clear();

    pds.add(new DefaultPortDescription(P1, false));
    pds.add(new DefaultPortDescription(P3, true));
    providerService.updatePorts(DID1, pds);
    validateEvents(PORT_UPDATED, PORT_REMOVED);
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:17,
代码来源:DeviceManagerTest.java

示例21: testUpdatePortStatus

点赞 3

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Test
public final void testUpdatePortStatus() {
    putDevice(DID1, SW1);
    List<PortDescription> pds = Arrays.<PortDescription>asList(
            new DefaultPortDescription(P1, true)
            );
    deviceStore.updatePorts(PID, DID1, pds);

    DeviceEvent event = deviceStore.updatePortStatus(PID, DID1,
            new DefaultPortDescription(P1, false));
    assertEquals(PORT_UPDATED, event.type());
    assertDevice(DID1, SW1, event.subject());
    assertEquals(P1, event.port().number());
    assertFalse("Port is disabled", event.port().isEnabled());

}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:17,
代码来源:SimpleDeviceStoreTest.java

示例22: getPorts

点赞 2

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Override
public List<PortDescription> getPorts() {
    NetconfController controller = checkNotNull(handler().get(NetconfController.class));
    NetconfSession session = controller.getDevicesMap().get(handler().data().deviceId()).getSession();
    String reply;
    try {
        reply = session.get(requestBuilder());
    } catch (IOException e) {
        throw new RuntimeException(new NetconfException("Failed to retrieve configuration.", e));
    }
    List<PortDescription> descriptions =
            parseFujitsuT100Ports(XmlConfigParser.
                    loadXml(new ByteArrayInputStream(reply.getBytes())));
    return descriptions;
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:16,
代码来源:PortGetterFujitsuImpl.java

示例23: parseT100OchPort

点赞 2

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
private static PortDescription parseT100OchPort(HierarchicalConfiguration cfg, long count) {
    PortNumber portNumber = PortNumber.portNumber(count);
    HierarchicalConfiguration otuConfig = cfg.configurationAt("otu");
    boolean enabled = otuConfig.getString("administrative-state").equals("up");
    OduSignalType signalType = otuConfig.getString("rate").equals("OTU4") ? OduSignalType.ODU4 : null;
    //Unsure how to retreive, outside knowledge it is tunable.
    boolean isTunable = true;
    OchSignal lambda = new OchSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, 0, 4);
    DefaultAnnotations annotations = DefaultAnnotations.builder().
            set(AnnotationKeys.PORT_NAME, cfg.getString("name")).
            build();
    return ochPortDescription(portNumber, enabled, signalType, isTunable, lambda, annotations);
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:14,
代码来源:PortGetterFujitsuImpl.java

示例24: parseT100OduPort

点赞 2

import org.onosproject.net.device.PortDescription; //导入依赖的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

示例25: addPort

点赞 2

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Deprecated
@Override
public void addPort(PortDescription port) {
    DriverHandler handler = handler();
    OvsdbClientService clientService = getOvsdbClientService(handler);
    Set<OvsdbBridge> ovsdbSet = clientService.getBridges();
    if (ovsdbSet != null && ovsdbSet.size() > 0) {
        OvsdbBridge bridge = ovsdbSet.iterator().next();
        clientService.createPort(bridge.bridgeName().value(), port
                .portNumber().toString());
    }
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:13,
代码来源:OvsdbBridgeConfig.java

示例26: deletePort

点赞 2

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Deprecated
@Override
public void deletePort(PortDescription port) {
    DriverHandler handler = handler();
    OvsdbClientService clientService = getOvsdbClientService(handler);
    Set<OvsdbBridge> ovsdbSet = clientService.getBridges();
    if (ovsdbSet != null && ovsdbSet.size() > 0) {
        OvsdbBridge bridge = ovsdbSet.iterator().next();
        clientService.dropPort(bridge.bridgeName().value(), port
                .portNumber().toString());
    }
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:13,
代码来源:OvsdbBridgeConfig.java

示例27: getPorts

点赞 2

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Override
public Collection<PortDescription> getPorts() {
    DriverHandler handler = handler();
    OvsdbClientService clientService = getOvsdbClientService(handler);
    Set<OvsdbPort> ports = clientService.getPorts();

    return ports.stream()
            .map(x -> new DefaultPortDescription(
                            PortNumber.portNumber(x.portNumber().value()),
                            true,
                            DefaultAnnotations.builder()
                                    .set("portName", x.portName().value())
                                    .build()))
            .collect(Collectors.toSet());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:16,
代码来源:OvsdbBridgeConfig.java

示例28: switchChanged

点赞 2

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Override
public void switchChanged(Dpid dpid) {
    LOG.debug("switchChanged({})", dpid);
    if (providerService == null) {
        return;
    }
    DeviceId did = deviceId(uri(dpid));
    OpenFlowSwitch sw = controller.getSwitch(dpid);
    if (sw == null) {
        return;
    }
    final List<PortDescription> ports = buildPortDescriptions(sw);
    LOG.debug("switchChanged({}) {}", did, ports);
    providerService.updatePorts(did, ports);
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:16,
代码来源:OpenFlowDeviceProvider.java

示例29: buildOduCltPortDescription

点赞 2

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
private PortDescription buildOduCltPortDescription(OFPortDesc port) {
    PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber());
    boolean enabled = !port.getState().contains(OFPortState.LINK_DOWN) &&
            !port.getConfig().contains(OFPortConfig.PORT_DOWN);
    Long portSpeedInMbps = portSpeed(port);
    CltSignalType sigType = null;

    switch (portSpeedInMbps.toString()) {
        case "1000":
            sigType = CltSignalType.CLT_1GBE;
            break;
        case "10000":
            sigType = CltSignalType.CLT_10GBE;
            break;
        case "40000":
            sigType = CltSignalType.CLT_40GBE;
            break;
        case "100000":
            sigType = CltSignalType.CLT_100GBE;
            break;
        default:
            throw new RuntimeException("Un recognize OduClt speed: " + portSpeedInMbps.toString());
    }

    SparseAnnotations annotations = buildOduCltAnnotation(port);
    return oduCltPortDescription(portNo, enabled, sigType, annotations);
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:28,
代码来源:OpenFlowDeviceProvider.java

示例30: switchChanged

点赞 2

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Test
public void switchChanged() {
    controller.listener.switchChanged(DPID1);
    Collection<PortDescription> updatedDescr = registry.ports.values();
    for (PortDescription pd : updatedDescr) {
        assertNotNull("Switch change not handled by the provider service", pd);
    }
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:9,
代码来源:OpenFlowDeviceProviderTest.java

示例31: buildPorts

点赞 2

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
/**
 * Generates a list of a configured number of ports.
 *
 * @param portCount number of ports
 * @return list of ports
 */
protected List<PortDescription> buildPorts(int portCount) {
    List<PortDescription> ports = Lists.newArrayList();
    for (int i = 0; i < portCount; i++) {
        ports.add(new DefaultPortDescription(PortNumber.portNumber(i), true,
                                             Port.Type.COPPER, 0));
    }
    return ports;
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:15,
代码来源:TopologySimulator.java

示例32: read

点赞 2

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Override
public InternalPortEvent read(Kryo kryo, Input input,
                           Class<InternalPortEvent> type) {
    ProviderId providerId = (ProviderId) kryo.readClassAndObject(input);
    DeviceId deviceId = (DeviceId) kryo.readClassAndObject(input);

    @SuppressWarnings("unchecked")
    Timestamped<List<PortDescription>> portDescriptions
        = (Timestamped<List<PortDescription>>) kryo.readClassAndObject(input);

    return new InternalPortEvent(providerId, deviceId, portDescriptions);
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:13,
代码来源:InternalPortEventSerializer.java

示例33: portStatusChanged

点赞 2

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
@Override
public void portStatusChanged(DeviceId deviceId,
                              PortDescription portDescription) {
    checkValidity();

    DeviceProviderServiceMsg.Builder builder = DeviceProviderServiceMsg.newBuilder();
    builder.setPortStatusChanged(builder.getPortStatusChangedBuilder()
                                  .setDeviceId(deviceId.toString())
                                  .setPortDescription(translate(portDescription))
                                  .build());

    devProvService.onNext(builder.build());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:14,
代码来源:DeviceProviderServiceClientProxy.java

示例34: translate

点赞 2

import org.onosproject.net.device.PortDescription; //导入依赖的package包/类
/**
 * Translates gRPC PortDescription message to {@link PortDescription}.
 *
 * @param portDescription gRPC message
 * @return {@link PortDescription}
 */
public static PortDescription translate(org.onosproject.grpc.net.Port.PortDescription portDescription) {
    PortNumber number = PortNumber.fromString(portDescription.getPortNumber());
    boolean isEnabled = portDescription.getIsEnabled();
    Port.Type type = translate(portDescription.getType());
    long portSpeed = portDescription.getPortSpeed();
    SparseAnnotations annotations = asAnnotations(portDescription.getAnnotations());
    // TODO How to deal with more specific Port...
    return new DefaultPortDescription(number, isEnabled, type, portSpeed, annotations);
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:16,
代码来源:GrpcDeviceUtils.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)