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


Java OspfNonPseudonode类代码示例

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


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

示例1: add

import org.onosproject.bgpio.types.OspfNonPseudonode; //导入依赖的package包/类
/**
 * Obtains instance of this class by appending stringBuilder with node descriptor value.
 *
 * @param value node descriptor
 * @return instance of this class
 */
public BgpDpid add(final NodeDescriptors value) {
    log.info("BgpDpid :: add function");
    if (value != null) {
        List<BgpValueType> subTlvs = value.getSubTlvs();
        ListIterator<BgpValueType> listIterator = subTlvs.listIterator();
        while (listIterator.hasNext()) {
            BgpValueType tlv = listIterator.next();
            if (tlv.getType() == AutonomousSystemTlv.TYPE) {
                this.stringBuilder.append(":ASN=").append(((AutonomousSystemTlv) tlv).getAsNum());
            } else if (tlv.getType() == BgpLSIdentifierTlv.TYPE) {
                this.stringBuilder.append(":DOMAINID=").append(((BgpLSIdentifierTlv) tlv).getBgpLsIdentifier());
            } else if (tlv.getType() == NodeDescriptors.IGP_ROUTERID_TYPE) {
                if (tlv instanceof IsIsNonPseudonode) {
                    this.stringBuilder.append(":ISOID=").append(
                            isoNodeIdString(((IsIsNonPseudonode) tlv).getIsoNodeId()));
                } else if (tlv instanceof IsIsPseudonode) {
                    IsIsPseudonode isisPseudonode = ((IsIsPseudonode) tlv);
                    this.stringBuilder.append(":ISOID=").append(
                            isoNodeIdString(((IsIsPseudonode) tlv).getIsoNodeId()));
                    this.stringBuilder.append(":PSN=").append(isisPseudonode.getPsnIdentifier());
                } else if (tlv instanceof OspfNonPseudonode) {
                    this.stringBuilder.append(":RID=").append(((OspfNonPseudonode) tlv).getrouterID());
                } else if (tlv instanceof OspfPseudonode) {
                    this.stringBuilder.append(":RID=").append(((OspfPseudonode) tlv).getrouterID());
                }
            }
        }
    }
    return this;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:37,代码来源:BgpDpid.java

示例2: add

import org.onosproject.bgpio.types.OspfNonPseudonode; //导入依赖的package包/类
/**
 * Obtains instance of this class by appending stringBuilder with node descriptor value.
 *
 * @param value node descriptor
 * @return instance of this class
 */
public BgpDpid add(final NodeDescriptors value) {
    log.debug("BgpDpid :: add function");
    if (value != null) {
        List<BgpValueType> subTlvs = value.getSubTlvs();
        ListIterator<BgpValueType> listIterator = subTlvs.listIterator();
        while (listIterator.hasNext()) {
            BgpValueType tlv = listIterator.next();
            if (tlv.getType() == AutonomousSystemTlv.TYPE) {
                this.stringBuilder.append(":ASN=").append(((AutonomousSystemTlv) tlv).getAsNum());
            } else if (tlv.getType() == BgpLSIdentifierTlv.TYPE) {
                this.stringBuilder.append(":DOMAINID=").append(((BgpLSIdentifierTlv) tlv).getBgpLsIdentifier());
            } else if (tlv.getType() == NodeDescriptors.IGP_ROUTERID_TYPE) {
                if (tlv instanceof IsIsNonPseudonode) {
                    this.stringBuilder.append(":ISOID=").append(
                            isoNodeIdString(((IsIsNonPseudonode) tlv).getIsoNodeId()));
                } else if (tlv instanceof IsIsPseudonode) {
                    IsIsPseudonode isisPseudonode = ((IsIsPseudonode) tlv);
                    this.stringBuilder.append(":ISOID=").append(
                            isoNodeIdString(((IsIsPseudonode) tlv).getIsoNodeId()));
                    this.stringBuilder.append(":PSN=").append(isisPseudonode.getPsnIdentifier());
                } else if (tlv instanceof OspfNonPseudonode) {
                    this.stringBuilder.append(":RID=").append(((OspfNonPseudonode) tlv).getrouterID());
                } else if (tlv instanceof OspfPseudonode) {
                    this.stringBuilder.append(":RID=").append(((OspfPseudonode) tlv).getrouterID());
                }
            }
        }
    }
    return this;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:37,代码来源:BgpDpid.java

示例3: read

import org.onosproject.bgpio.types.OspfNonPseudonode; //导入依赖的package包/类
/**
 * Reads node descriptors Sub-TLVs.
 *
 * @param cb ChannelBuffer
 * @param desLength node descriptor length
 * @param desType local node descriptor or remote node descriptor type
 * @param protocolId protocol ID
 * @return object of NodeDescriptors
 * @throws BgpParseException while parsing node descriptors
 */
public static NodeDescriptors read(ChannelBuffer cb, short desLength, short desType, byte protocolId)
        throws BgpParseException {
    log.debug("Read NodeDescriptor");
    List<BgpValueType> subTlvs = new LinkedList<>();
    BgpValueType tlv = null;

    while (cb.readableBytes() > 0) {
        ChannelBuffer tempBuf = cb.copy();
        short type = cb.readShort();
        short length = cb.readShort();
        if (cb.readableBytes() < length) {
            throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR,
                    tempBuf.readBytes(cb.readableBytes() + TYPE_AND_LEN));
        }
        ChannelBuffer tempCb = cb.readBytes(length);
        switch (type) {
        case AutonomousSystemTlv.TYPE:
            tlv = AutonomousSystemTlv.read(tempCb);
            break;
        case BgpLSIdentifierTlv.TYPE:
            tlv = BgpLSIdentifierTlv.read(tempCb);
            break;
        case AreaIDTlv.TYPE:
            tlv = AreaIDTlv.read(tempCb);
            break;
        case IGP_ROUTERID_TYPE:
            if (protocolId == IS_IS_LEVEL_1_PROTOCOL_ID || protocolId == IS_IS_LEVEL_2_PROTOCOL_ID) {
                boolean isNonPseudoNode = true;
                if ((length == ISISPSEUDONODE_LEN) && (tempCb.getByte(ISISPSEUDONODE_LEN - 1) != 0)) {
                    isNonPseudoNode = false;
                }
                if (isNonPseudoNode) {
                    tlv = IsIsNonPseudonode.read(tempCb);
                } else {
                    tlv = IsIsPseudonode.read(tempCb);
                }
            } else if (protocolId == OSPF_V2_PROTOCOL_ID || protocolId == OSPF_V3_PROTOCOL_ID) {
                if (length == OSPFNONPSEUDONODE_LEN) {
                    tlv = OspfNonPseudonode.read(tempCb);
                } else if (length == OSPFPSEUDONODE_LEN) {
                    tlv = OspfPseudonode.read(tempCb);
                }
            }
            break;
        default:
            UnSupportedAttribute.skipBytes(tempCb, length);
        }
        subTlvs.add(tlv);
    }
    return new NodeDescriptors(subTlvs, desLength, desType);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:62,代码来源:NodeDescriptors.java

示例4: compareTo

import org.onosproject.bgpio.types.OspfNonPseudonode; //导入依赖的package包/类
/**
 * Compares this and o object.
 *
 * @param o object to be compared with this object
 * @return which object is greater
 */
public int compareTo(Object o) {
    if (this.equals(o)) {
        return 0;
    }
    ListIterator<BgpValueType> listIterator = subTlvs.listIterator();
    int countOtherSubTlv = ((NodeDescriptors) o).subTlvs.size();
    int countObjSubTlv = subTlvs.size();
    boolean tlvFound = false;
    if (countOtherSubTlv != countObjSubTlv) {
        if (countOtherSubTlv > countObjSubTlv) {
            return 1;
        } else {
            return -1;
        }
    } else {
        while (listIterator.hasNext()) {
            BgpValueType tlv1 = listIterator.next();
            log.debug("NodeDescriptor compare subtlv's");
            for (BgpValueType tlv : ((NodeDescriptors) o).subTlvs) {
                if (tlv.getType() == tlv1.getType()) {
                    if (tlv.getType() == IGP_ROUTERID_TYPE) {
                        if ((tlv1 instanceof IsIsNonPseudonode && tlv instanceof IsIsPseudonode)
                            || (tlv1 instanceof IsIsPseudonode && tlv instanceof IsIsNonPseudonode)
                            || (tlv1 instanceof OspfNonPseudonode && tlv instanceof OspfPseudonode)
                            || (tlv1 instanceof OspfPseudonode && tlv instanceof OspfNonPseudonode)) {
                            continue;
                        }
                    }
                    int result = subTlvs.get(subTlvs.indexOf(tlv1)).compareTo(
                            ((NodeDescriptors) o).subTlvs.get(((NodeDescriptors) o).subTlvs.indexOf(tlv)));
                    if (result != 0) {
                        return result;
                    }
                    tlvFound = true;
                    break;
                }
            }
            if (!tlvFound) {
                return 1;
            }
        }
    }
    return 0;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:51,代码来源:NodeDescriptors.java

示例5: addNode

import org.onosproject.bgpio.types.OspfNonPseudonode; //导入依赖的package包/类
@Override
public void addNode(BgpNodeLSNlriVer4 nodeNlri, PathAttrNlriDetails details) {
    log.debug("Add node {}", nodeNlri.toString());

    if (deviceProviderService == null || deviceService == null) {
        return;
    }
    Device.Type deviceType = ROUTER;
    BgpDpid nodeUri = new BgpDpid(nodeNlri);
    DeviceId deviceId = deviceId(uri(nodeUri.toString()));
    ChassisId cId = new ChassisId();

    /*
     * Check if device is already there (available) , if yes not updating to core.
     */
    if (deviceService.isAvailable(deviceId)) {
        return;
    }

    DefaultAnnotations.Builder newBuilder = DefaultAnnotations.builder();

    newBuilder.set(AnnotationKeys.DRIVER, "l3Device");
    newBuilder.set(AnnotationKeys.TYPE, "L3");
    newBuilder.set(ROUTING_UNIVERSE, Long.toString(nodeNlri.getIdentifier()));

    List<BgpValueType> tlvs = nodeNlri.getLocalNodeDescriptors().getNodedescriptors().getSubTlvs();
    for (BgpValueType tlv : tlvs) {
        if (tlv instanceof AutonomousSystemTlv) {
            newBuilder.set(AS_NUMBER, Integer.toString(((AutonomousSystemTlv) tlv).getAsNum()));
        } else if (tlv instanceof BgpLSIdentifierTlv) {
            newBuilder.set(DOMAIN_IDENTIFIER,
                    Integer.toString(((BgpLSIdentifierTlv) tlv).getBgpLsIdentifier()));
        }
        if (tlv.getType() == NodeDescriptors.IGP_ROUTERID_TYPE) {
            if (tlv instanceof IsIsPseudonode) {
                deviceType = VIRTUAL;
                newBuilder.set(AnnotationKeys.ROUTER_ID, nodeUri.isoNodeIdString(((IsIsPseudonode) tlv)
                        .getIsoNodeId()));
            } else if (tlv instanceof OspfPseudonode) {
                deviceType = VIRTUAL;
                newBuilder
                        .set(AnnotationKeys.ROUTER_ID, Integer.toString(((OspfPseudonode) tlv).getrouterID()));
            } else if (tlv instanceof IsIsNonPseudonode) {
                newBuilder.set(AnnotationKeys.ROUTER_ID, nodeUri.isoNodeIdString(((IsIsNonPseudonode) tlv)
                        .getIsoNodeId()));
            } else if (tlv instanceof OspfNonPseudonode) {
                newBuilder.set(AnnotationKeys.ROUTER_ID,
                        Integer.toString(((OspfNonPseudonode) tlv).getrouterID()));
            }
        }
    }
    DefaultAnnotations.Builder anntotations = DefaultAnnotations.builder();
    anntotations = getAnnotations(newBuilder, true, details);

    DeviceDescription description = new DefaultDeviceDescription(uri(nodeUri.toString()), deviceType, UNKNOWN,
            UNKNOWN, UNKNOWN, UNKNOWN, cId, anntotations.build());

    deviceProviderService.deviceConnected(deviceId, description);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:60,代码来源:BgpTopologyProvider.java

示例6: addNode

import org.onosproject.bgpio.types.OspfNonPseudonode; //导入依赖的package包/类
@Override
public void addNode(BgpNodeLSNlriVer4 nodeNlri, PathAttrNlriDetails details) {
    log.debug("Add node {}", nodeNlri.toString());

    if (deviceProviderService == null || deviceService == null) {
        return;
    }
    Device.Type deviceType = ROUTER;
    BgpDpid nodeUri = new BgpDpid(nodeNlri);
    DeviceId deviceId = deviceId(uri(nodeUri.toString()));
    ChassisId cId = new ChassisId();

    /*
     * Check if device is already there (available) , if yes not updating to core.
     */
    if (deviceService.isAvailable(deviceId)) {
        return;
    }

    DefaultAnnotations.Builder newBuilder = DefaultAnnotations.builder();

    newBuilder.set(AnnotationKeys.TYPE, "L3");
    newBuilder.set(ROUTING_UNIVERSE, Long.toString(nodeNlri.getIdentifier()));

    List<BgpValueType> tlvs = nodeNlri.getLocalNodeDescriptors().getNodedescriptors().getSubTlvs();
    for (BgpValueType tlv : tlvs) {
        if (tlv instanceof AutonomousSystemTlv) {
            newBuilder.set(AS_NUMBER, Integer.toString(((AutonomousSystemTlv) tlv).getAsNum()));
        } else if (tlv instanceof BgpLSIdentifierTlv) {
            newBuilder.set(DOMAIN_IDENTIFIER,
                    Integer.toString(((BgpLSIdentifierTlv) tlv).getBgpLsIdentifier()));
        }
        if (tlv.getType() == NodeDescriptors.IGP_ROUTERID_TYPE) {
            if (tlv instanceof IsIsPseudonode) {
                deviceType = VIRTUAL;
                newBuilder.set(AnnotationKeys.ROUTER_ID, nodeUri.isoNodeIdString(((IsIsPseudonode) tlv)
                        .getIsoNodeId()));
            } else if (tlv instanceof OspfPseudonode) {
                deviceType = VIRTUAL;
                newBuilder
                        .set(AnnotationKeys.ROUTER_ID, Integer.toString(((OspfPseudonode) tlv).getrouterID()));
            } else if (tlv instanceof IsIsNonPseudonode) {
                newBuilder.set(AnnotationKeys.ROUTER_ID, nodeUri.isoNodeIdString(((IsIsNonPseudonode) tlv)
                        .getIsoNodeId()));
            } else if (tlv instanceof OspfNonPseudonode) {
                newBuilder.set(AnnotationKeys.ROUTER_ID,
                        Integer.toString(((OspfNonPseudonode) tlv).getrouterID()));
            }
        }
    }
    DefaultAnnotations.Builder anntotations = DefaultAnnotations.builder();
    anntotations = getAnnotations(newBuilder, true, details);

    DeviceDescription description = new DefaultDeviceDescription(uri(nodeUri.toString()), deviceType, UNKNOWN,
            UNKNOWN, UNKNOWN, UNKNOWN, cId, anntotations.build());

    deviceProviderService.deviceConnected(deviceId, description);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:59,代码来源:BgpTopologyProvider.java


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