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


Java IpPrefix类代码示例

本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix的典型用法代码示例。如果您正苦于以下问题:Java IpPrefix类的具体用法?Java IpPrefix怎么用?Java IpPrefix使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IpPrefix类属于org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715包,在下文中一共展示了IpPrefix类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildArpIpMatches

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; //导入依赖的package包/类
/**
 * Builds the arp ip matches.
 * @param ipPrefixOrAddress the ip prefix or address
 * @return the MatchInfoBase list
 */
public static List<MatchInfoBase> buildArpIpMatches(IpPrefixOrAddress ipPrefixOrAddress) {
    List<MatchInfoBase> flowMatches = new ArrayList<>();
    IpPrefix ipPrefix = ipPrefixOrAddress.getIpPrefix();
    if (ipPrefix != null) {
        Ipv4Prefix ipv4Prefix = ipPrefix.getIpv4Prefix();
        if (ipv4Prefix != null && !ipv4Prefix.getValue().equals(AclConstants.IPV4_ALL_NETWORK)) {
            flowMatches.add(new MatchArpSpa(ipv4Prefix));
        }
    } else {
        IpAddress ipAddress = ipPrefixOrAddress.getIpAddress();
        if (ipAddress != null && ipAddress.getIpv4Address() != null) {
            flowMatches.add(new MatchArpSpa(ipAddress.getIpv4Address().getValue(), "32"));
        }
    }
    return flowMatches;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:22,代码来源:AclServiceUtils.java

示例2: createGateway

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; //导入依赖的package包/类
/**
 * Create a gateway for a logical swtich on a given router.
 * @param fId - fabric identifier.
 * @param lrId - logical router identifier.
 * @param lswId - logical switch identifier.
 * @param gatewayIpAddr - the gateway Ip address
 * @param ipPrefix - network prefix.
 * @return the mac address of the gateway
 */
public MacAddress createGateway(NodeId fId, NodeId lrId, NodeId lswId, IpAddress gatewayIpAddr,
        IpPrefix ipPrefix) {
    CreateGatewayInputBuilder inputBuilder = new CreateGatewayInputBuilder();
    FabricId fabricId = new FabricId(fId);
    inputBuilder.setFabricId(fabricId);
    inputBuilder.setLogicalRouter(new NodeId(lrId));
    inputBuilder.setLogicalSwitch(new NodeId(lswId));
    inputBuilder.setIpAddress(new IpAddress(gatewayIpAddr));
    inputBuilder.setNetwork(new IpPrefix(ipPrefix));

    Future<RpcResult<CreateGatewayOutput>> result = this.fabServiceService.createGateway(inputBuilder.build());
    try {
        RpcResult<CreateGatewayOutput> output = result.get();
        if (output.isSuccessful()) {
            LOG.debug("FABMGR: createLrLswGateway: createGateway RPC success");
            CreateGatewayOutput o = output.getResult();
            return o.getPortLayer().getLayer3Info().getMac();
        }
    } catch (Exception e) {
        LOG.error("FABMGR: ERROR: createLrLswGateway: createGateway RPC failed.", e);
    }

    return null;
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:34,代码来源:VContainerNetNodeServiceProvider.java

示例3: createLrLswGateway

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; //导入依赖的package包/类
/**
 * Create a gateway for a logical swtich on a given router.
 * @param fId - fabric identifier.
 * @param lrId - logical router identifier.
 * @param lswId - logical switch identifier.
 * @param gatewayIpAddr - the gateway Ip address
 * @param ipPrefix - network prefix.
 * @return the gw logical port TpId.
 */
public Uuid createLrLswGateway(NodeId fId, NodeId lrId, NodeId lswId, IpAddress gatewayIpAddr,
        IpPrefix ipPrefix) {
    CreateGatewayInputBuilder inputBuilder = new CreateGatewayInputBuilder();
    FabricId fabricId = new FabricId(fId);
    inputBuilder.setFabricId(fabricId);
    inputBuilder.setLogicalRouter(new NodeId(lrId));
    inputBuilder.setLogicalSwitch(new NodeId(lswId));
    inputBuilder.setIpAddress(new IpAddress(gatewayIpAddr));
    inputBuilder.setNetwork(new IpPrefix(ipPrefix));

    Future<RpcResult<CreateGatewayOutput>> result = this.fabServiceService.createGateway(inputBuilder.build());
    try {
        RpcResult<CreateGatewayOutput> output = result.get();
        if (output.isSuccessful()) {
            LOG.debug("FABMGR: createLrLswGateway: createGateway RPC success");
            CreateGatewayOutput o = output.getResult();
            return o.getLportUuid();
        }
    } catch (Exception e) {
        LOG.error("FABMGR: ERROR: createLrLswGateway: createGateway RPC failed.", e);
    }

    return null;
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:34,代码来源:VContainerNetNodeServiceProvider.java

示例4: createLrLswGateway

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; //导入依赖的package包/类
@Override
public Uuid createLrLswGateway(Uuid tenantId, NodeId vfabricId, NodeId lrId, NodeId lswId, IpAddress gatewayIpAddr,
        IpPrefix ipPrefix) {
    VContainerConfigMgr vcMgr = containerMgr.getVcConfigDataMgr(tenantId);
    if (vcMgr == null) {
        LOG.error("FABMGR: ERROR: createLrLswGateway: vcMgr is null: tenantId={}", tenantId.getValue());
        return null; // ----->
    }

    if (!vcMgr.getLdNodeConfigDataMgr().isVFabricAvailable(vfabricId)) {
        LOG.error("FABMGR: ERROR: createLrLswGateway: vfabricId is null: {}", tenantId.getValue());
        return null; // ---->
    }

    return  this.netNodeServiceProvider.createLrLswGateway(vfabricId, lrId, lswId, gatewayIpAddr, ipPrefix);
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:17,代码来源:FabricMgrProvider.java

示例5: toMd

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; //导入依赖的package包/类
@Override
protected MeteringRule toMd(NeutronMeteringLabelRule meteringLabelRule) {
    final MeteringRuleBuilder meteringRuleBuilder = new MeteringRuleBuilder();
    toMdIds(meteringLabelRule, meteringRuleBuilder);
    if (meteringLabelRule.getMeteringLabelRuleLabelID() != null) {
        meteringRuleBuilder.setMeteringLabelId(toUuid(meteringLabelRule.getMeteringLabelRuleLabelID()));
    }
    if (meteringLabelRule.getMeteringLabelRuleDirection() != null) {
        meteringRuleBuilder.setDirection(
                DirectionMapper.get(meteringLabelRule.getMeteringLabelRuleDirection()));
    }
    if (meteringLabelRule.getMeteringLabelRuleRemoteIpPrefix() != null) {
        final IpPrefix ipPrefix = new IpPrefix(
                meteringLabelRule.getMeteringLabelRuleRemoteIpPrefix().toCharArray());
        meteringRuleBuilder.setRemoteIpPrefix(ipPrefix);
    }
    meteringRuleBuilder.setExcluded(meteringLabelRule.getMeteringLabelRuleExcluded());
    return meteringRuleBuilder.build();
}
 
开发者ID:opendaylight,项目名称:neutron,代码行数:20,代码来源:NeutronMeteringLabelRuleInterface.java

示例6: parseSubobject

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; //导入依赖的package包/类
@Override
public Subobject parseSubobject(final ByteBuf buffer, final boolean mandatory) throws PCEPDeserializerException {
    Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
    final SubobjectBuilder builder = new SubobjectBuilder();
    builder.setMandatory(mandatory);
    if (buffer.readableBytes() != CONTENT4_LENGTH) {
        throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + buffer.readableBytes() + ";");
    }
    final int length = buffer.getUnsignedByte(PREFIX4_F_OFFSET);
    final IpPrefixBuilder prefix = new IpPrefixBuilder().setIpPrefix(new IpPrefix(Ipv4Util.prefixForBytes(ByteArray.readBytes(buffer,
            Ipv4Util.IP4_LENGTH), length)));
    builder.setSubobjectType(new IpPrefixCaseBuilder().setIpPrefix(prefix.build()).build());
    buffer.skipBytes(PREFIX_F_LENGTH);
    builder.setAttribute(Attribute.forValue(buffer.readUnsignedByte()));
    return builder.build();
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:17,代码来源:XROIpv4PrefixSubobjectParser.java

示例7: serializeSubobject

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; //导入依赖的package包/类
@Override
public void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
    Preconditions.checkArgument(subobject.getSubobjectType() instanceof IpPrefixCase, "Unknown subobject instance. Passed %s. Needed IpPrefixCase.", subobject.getSubobjectType().getClass());
    final IpPrefixSubobject specObj = ((IpPrefixCase) subobject.getSubobjectType()).getIpPrefix();
    final IpPrefix prefix = specObj.getIpPrefix();
    Preconditions.checkArgument(prefix.getIpv4Prefix() != null || prefix.getIpv6Prefix() != null, "Unknown AbstractPrefix instance. Passed %s.", prefix.getClass());
    if (prefix.getIpv6Prefix() != null) {
        new XROIpv6PrefixSubobjectParser().serializeSubobject(subobject, buffer);
    } else {
        final ByteBuf body = Unpooled.buffer(CONTENT4_LENGTH);
        Preconditions.checkArgument(prefix.getIpv4Prefix() != null, "Ipv4Prefix is mandatory.");
        writeIpv4Prefix(prefix.getIpv4Prefix(), body);
        Preconditions.checkArgument(subobject.getAttribute() != null, "Attribute is mandatory.");
        writeUnsignedByte((short) subobject.getAttribute().getIntValue(), body);
        XROSubobjectUtil.formatSubobject(TYPE, subobject.isMandatory(), body, buffer);
    }
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:18,代码来源:XROIpv4PrefixSubobjectParser.java

示例8: parseSubobject

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; //导入依赖的package包/类
@Override
public Subobject parseSubobject(final ByteBuf buffer) throws PCEPDeserializerException {
    Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
    final SubobjectBuilder builder = new SubobjectBuilder();
    if (buffer.readableBytes() != CONTENT_LENGTH) {
        throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + buffer.readableBytes() + ";");
    }
    final int length = buffer.getUnsignedByte(PREFIX_F_OFFSET);
    final IpPrefixBuilder prefix = new IpPrefixBuilder().setIpPrefix(new IpPrefix(Ipv6Util.prefixForBytes(ByteArray.readBytes(buffer,
            Ipv6Util.IPV6_LENGTH), length)));
    buffer.skipBytes(PREFIX_F_LENGTH);
    final BitArray flags = BitArray.valueOf(buffer, FLAGS_SIZE);
    builder.setProtectionAvailable(flags.get(LPA_F_OFFSET));
    builder.setProtectionInUse(flags.get(LPIU_F_OFFSET));
    builder.setSubobjectType(new IpPrefixCaseBuilder().setIpPrefix(prefix.build()).build());
    return builder.build();
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:18,代码来源:RROIpv6PrefixSubobjectParser.java

示例9: serializeSubobject

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; //导入依赖的package包/类
@Override
public void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
    Preconditions.checkArgument(subobject.getSubobjectType() instanceof IpPrefixCase, "Unknown subobject instance. Passed %s. Needed IpPrefixCase.", subobject.getSubobjectType().getClass());
    final IpPrefixSubobject specObj = ((IpPrefixCase) subobject.getSubobjectType()).getIpPrefix();
    final IpPrefix prefix = specObj.getIpPrefix();
    Preconditions.checkArgument(prefix.getIpv4Prefix() != null || prefix.getIpv6Prefix() != null, "Unknown AbstractPrefix instance. Passed %s.", prefix.getClass());
    if (prefix.getIpv6Prefix() != null) {
        new EROIpv6PrefixSubobjectParser().serializeSubobject(subobject, buffer);
    } else {
        final ByteBuf body = Unpooled.buffer(CONTENT4_LENGTH);
        Preconditions.checkArgument(prefix.getIpv4Prefix() != null, "Ipv4Prefix is mandatory.");
        writeIpv4Prefix(prefix.getIpv4Prefix(), body);
        body.writeZero(RESERVED);
        EROSubobjectUtil.formatSubobject(TYPE, subobject.isLoose(), body, buffer);
    }
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:17,代码来源:EROIpv4PrefixSubobjectParser.java

示例10: parseSubobject

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; //导入依赖的package包/类
@Override
public Subobject parseSubobject(final ByteBuf buffer, final boolean mandatory) throws PCEPDeserializerException {
    Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
    final SubobjectBuilder builder = new SubobjectBuilder();
    builder.setMandatory(mandatory);
    if (buffer.readableBytes() != CONTENT6_LENGTH) {
        throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + buffer.readableBytes() + ";");
    }
    final int length = buffer.getUnsignedByte(PREFIX6_F_OFFSET);
    final IpPrefixBuilder prefix = new IpPrefixBuilder().setIpPrefix(new IpPrefix(Ipv6Util.prefixForBytes(ByteArray.readBytes(buffer,
            Ipv6Util.IPV6_LENGTH), length)));
    builder.setSubobjectType(new IpPrefixCaseBuilder().setIpPrefix(prefix.build()).build());
    buffer.skipBytes(PREFIX_F_LENGTH);
    builder.setAttribute(Attribute.forValue(buffer.readUnsignedByte()));
    return builder.build();
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:17,代码来源:XROIpv6PrefixSubobjectParser.java

示例11: parseSubobject

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; //导入依赖的package包/类
@Override
public Subobject parseSubobject(final ByteBuf buffer) throws PCEPDeserializerException {
    Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
    if (buffer.readableBytes() != CONTENT4_LENGTH) {
        throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + buffer.readableBytes() + ";");
    }
    final SubobjectBuilder builder = new SubobjectBuilder();
    final int length = buffer.getUnsignedByte(PREFIX4_F_OFFSET);
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.ip.prefix._case.IpPrefix prefix = new IpPrefixBuilder().setIpPrefix(
            new IpPrefix(Ipv4Util.prefixForBytes(ByteArray.readBytes(buffer, Ipv4Util.IP4_LENGTH), length))).build();
    buffer.skipBytes(PREFIX_F_LENGTH);
    final BitArray flags = BitArray.valueOf(buffer, FLAGS_SIZE);
    builder.setProtectionAvailable(flags.get(LPA_F_OFFSET));
    builder.setProtectionInUse(flags.get(LPIU_F_OFFSET));
    builder.setSubobjectType(new IpPrefixCaseBuilder().setIpPrefix(prefix).build());
    return builder.build();
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:18,代码来源:RROIpv4PrefixSubobjectParser.java

示例12: serializeSubobject

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; //导入依赖的package包/类
@Override
public void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
    Preconditions.checkArgument(subobject.getSubobjectType() instanceof IpPrefixCase, "Unknown subobject instance. Passed %s. Needed IpPrefixCase.", subobject.getSubobjectType().getClass());
    final IpPrefixSubobject specObj = ((IpPrefixCase) subobject.getSubobjectType()).getIpPrefix();
    final IpPrefix prefix = specObj.getIpPrefix();
    Preconditions.checkArgument(prefix.getIpv4Prefix() != null || prefix.getIpv6Prefix() != null, "Unknown AbstractPrefix instance. Passed %s.", prefix.getClass());
    if (prefix.getIpv6Prefix() != null) {
        new RROIpv6PrefixSubobjectParser().serializeSubobject(subobject, buffer);
    } else {
        final BitArray flags = new BitArray(FLAGS_SIZE);
        flags.set(LPA_F_OFFSET, subobject.isProtectionAvailable());
        flags.set(LPIU_F_OFFSET, subobject.isProtectionInUse());
        final ByteBuf body = Unpooled.buffer(CONTENT4_LENGTH);
        Preconditions.checkArgument(prefix.getIpv4Prefix() != null, "Ipv4Prefix is mandatory.");
        writeIpv4Prefix(prefix.getIpv4Prefix(), body);
        flags.toByteBuf(body);
        RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
    }
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:20,代码来源:RROIpv4PrefixSubobjectParser.java

示例13: removePrefix

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; //导入依赖的package包/类
private void removePrefix(final WriteTransaction trans, final UriBuilder base, final PrefixCase prefixCase) {
    final NodeId node = buildNodeId(base, prefixCase.getAdvertisingNodeDescriptors());
    final NodeHolder nh = this.nodes.get(node);
    if (nh != null) {
        LOG.debug("Removed prefix {}", prefixCase);
        final InstanceIdentifier<Node> nid = getNodeInstanceIdentifier(new NodeKey(nh.getNodeId()));
        final InstanceIdentifier<IgpNodeAttributes> inaId = nid.builder().augmentation(Node1.class)
                .child(IgpNodeAttributes.class).build();
        final IpPrefix ippfx = prefixCase.getPrefixDescriptors().getIpReachabilityInformation();
        if (ippfx == null) {
            LOG.warn("IP reachability not present in prefix {}, skipping it", prefixCase);
            return;
        }
        final PrefixKey pk = new PrefixKey(ippfx);
        trans.delete(LogicalDatastoreType.OPERATIONAL, inaId.child(Prefix.class, pk));
        nh.removePrefix(prefixCase);
        checkNodeForRemoval(trans, nh);
    } else {
        LOG.warn("Removing prefix from non-existing node {}", node);
    }
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:22,代码来源:LinkstateTopologyBuilder.java

示例14: createLinkstatePrefixRoute

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; //导入依赖的package包/类
private static LinkstateRoute createLinkstatePrefixRoute(final ProtocolId protocolId, final AsNumber asNumber,
        final String ipv4Prefix, final long igpMetric, final String ospfFwdAddress) {
    return createBaseBuilder(protocolId)
        .setObjectType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207
                .linkstate.object.type.PrefixCaseBuilder()
            .setAdvertisingNodeDescriptors(new AdvertisingNodeDescriptorsBuilder().setAsNumber(asNumber).build())
            .setPrefixDescriptors(new PrefixDescriptorsBuilder()
                    .setIpReachabilityInformation(new IpPrefix(new Ipv4Prefix(ipv4Prefix))).build()).build())
        .setAttributes(new AttributesBuilder()
            .setOrigin(new OriginBuilder().setValue(BgpOrigin.Igp).build())
            .addAugmentation(Attributes1.class, new Attributes1Builder()
                    .setLinkStateAttribute(new PrefixAttributesCaseBuilder().setPrefixAttributes(
                            new PrefixAttributesBuilder().setOspfForwardingAddress(new IpAddress(
                                    new Ipv4Address(ospfFwdAddress))).setPrefixMetric(new IgpMetric(igpMetric))
                                    .build()).build()).build()).build()).build();
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:17,代码来源:LinkstateTopologyBuilderTest.java

示例15: serializeNlri

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; //导入依赖的package包/类
protected static void serializeNlri(final List<CLabeledUnicastDestination> dests, final boolean isUnreachNlri,
        final ByteBuf buffer) {
    final ByteBuf nlriByteBuf = Unpooled.buffer();
    for (final CLabeledUnicastDestination dest : dests) {
        PathIdUtil.writePathId(dest.getPathId(), buffer);

        final List<LabelStack> labelStack = dest.getLabelStack();
        final IpPrefix prefix = dest.getPrefix();
        // Serialize the length field
        // Length field contains one Byte which represents the length of label stack and prefix in bits
        nlriByteBuf.writeByte(((LABEL_LENGTH * (!isUnreachNlri ? labelStack.size() : 1)) + getPrefixLength(prefix)) * Byte.SIZE);

        serializeLabelStackEntries(labelStack, isUnreachNlri, nlriByteBuf);
        serializePrefixField(prefix, nlriByteBuf);
    }
    buffer.writeBytes(nlriByteBuf);
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:18,代码来源:LUNlriParser.java


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