• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Ipv4Prefix类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: buildArpIpMatches

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的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: testProgramUdpFlow_NoSrcDstPortRange

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
@Test
public void testProgramUdpFlow_NoSrcDstPortRange() {
    AceIpBuilder builder = new AceIpBuilder();
    AceIpv4Builder v4builder = new AceIpv4Builder();
    v4builder.setSourceIpv4Network(new Ipv4Prefix("10.1.1.1/24"));
    v4builder.setDestinationIpv4Network(new Ipv4Prefix("20.1.1.1/24"));
    builder.setAceIpVersion(v4builder.build());
    builder.setSourcePortRange(null);
    builder.setDestinationPortRange(null);
    short protocol = 1;
    builder.setProtocol(protocol);

    Map<String, List<MatchInfoBase>> flowMatchesMap = AclServiceOFFlowBuilder.programUdpFlow(builder.build());

    List<MatchInfoBase> flowMatches = flowMatchesMap.get("UDP_SOURCE_ALL_");

    AclServiceTestUtils.verifyGeneralFlows(flowMatches, "1", "10.1.1.1", "20.1.1.1", "24");
    AclServiceTestUtils.verifyMatchFieldTypeDontExist(flowMatches, NxMatchUdpSourcePort.class);
    AclServiceTestUtils.verifyMatchFieldTypeDontExist(flowMatches, NxMatchUdpDestinationPort.class);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:21,代码来源:AclServiceOFFlowBuilderTest.java


示例3: newMatch

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
protected Matches newMatch(int srcLowerPort, int srcUpperPort, int destLowerPort, int destupperPort,
        int srcRemoteIpPrefix, int dstRemoteIpPrefix, short protocol) {

    AceIpBuilder aceIpBuilder = new AceIpBuilder();
    if (destLowerPort != -1) {
        DestinationPortRangeBuilder destinationPortRangeBuilder = new DestinationPortRangeBuilder();
        destinationPortRangeBuilder.setLowerPort(new PortNumber(destLowerPort));
        destinationPortRangeBuilder.setUpperPort(new PortNumber(destupperPort));
        aceIpBuilder.setDestinationPortRange(destinationPortRangeBuilder.build());
    }
    AceIpv4Builder aceIpv4Builder = new AceIpv4Builder();
    if (srcRemoteIpPrefix == AclConstants.SOURCE_REMOTE_IP_PREFIX_SPECIFIED) {
        aceIpv4Builder.setSourceIpv4Network(new Ipv4Prefix(AclConstants.IPV4_ALL_NETWORK));
    }
    if (dstRemoteIpPrefix == AclConstants.DEST_REMOTE_IP_PREFIX_SPECIFIED) {
        aceIpv4Builder.setSourceIpv4Network(new Ipv4Prefix(AclConstants.IPV4_ALL_NETWORK));
    }
    if (protocol != -1) {
        aceIpBuilder.setProtocol(protocol);
    }
    aceIpBuilder.setAceIpVersion(aceIpv4Builder.build());

    MatchesBuilder matchesBuilder = new MatchesBuilder();
    matchesBuilder.setAceType(aceIpBuilder.build());
    return matchesBuilder.build();
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:27,代码来源:AclServiceTestBase.java


示例4: handleEtherType

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
private AceIpBuilder handleEtherType(SecurityRule securityRule, AceIpBuilder aceIpBuilder) {
    if (NeutronSecurityRuleConstants.ETHERTYPE_IPV4.equals(securityRule.getEthertype())) {
        AceIpv4Builder aceIpv4Builder = new AceIpv4Builder();
        aceIpv4Builder.setSourceIpv4Network(new Ipv4Prefix(
            NeutronSecurityRuleConstants.IPV4_ALL_NETWORK));
        aceIpv4Builder.setDestinationIpv4Network(new Ipv4Prefix(
            NeutronSecurityRuleConstants.IPV4_ALL_NETWORK));
        aceIpBuilder.setAceIpVersion(aceIpv4Builder.build());
    } else {
        AceIpv6Builder aceIpv6Builder = new AceIpv6Builder();
        aceIpv6Builder.setSourceIpv6Network(new Ipv6Prefix(
            NeutronSecurityRuleConstants.IPV6_ALL_NETWORK));
        aceIpv6Builder.setDestinationIpv6Network(new Ipv6Prefix(
            NeutronSecurityRuleConstants.IPV6_ALL_NETWORK));
        aceIpBuilder.setAceIpVersion(aceIpv6Builder.build());

    }
    return aceIpBuilder;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:20,代码来源:NeutronSecurityRuleListener.java


示例5: createDmacDestIpMatch

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
public static MatchBuilder createDmacDestIpMatch(MatchBuilder matchBuilder, String destMac,
        Ipv4Prefix destIpPrefix) {

    EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(0x0800L));
    ethernetMatch.setEthernetType(ethTypeBuilder.build());

    if (destMac != null) {
        EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder();
        ethDestinationBuilder.setAddress(new MacAddress(destMac));
        ethernetMatch.setEthernetDestination(ethDestinationBuilder.build());
        matchBuilder.setEthernetMatch(ethernetMatch.build());
    }

    if (destIpPrefix != null) {
        Ipv4Prefix canonicalizedIpv4Prefix = IpAddressUtils.canonicalizeIpPrefixToNetAddress(destIpPrefix);
        Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
        ipv4match.setIpv4Destination(canonicalizedIpv4Prefix);
        matchBuilder.setLayer3Match(ipv4match.build());
    }

    return matchBuilder;
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:25,代码来源:OfMatchUtils.java


示例6: createDstL3IPv4Match

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
/**
 * @param matchBuilder
 *            MatchBuilder Object without a match yet
 * @param dstip
 *            String containing an IPv4 prefix
 * @return matchBuilder Map Object with a match
 */
public static MatchBuilder createDstL3IPv4Match(MatchBuilder matchBuilder, Ipv4Prefix dstip) {

    EthernetMatchBuilder eth = new EthernetMatchBuilder();
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(0x0800L));
    eth.setEthernetType(ethTypeBuilder.build());
    matchBuilder.setEthernetMatch(eth.build());

    Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
    Ipv4Prefix canonicalizedIpv4Prefix = IpAddressUtils.canonicalizeIpPrefixToNetAddress(dstip);
    ipv4match.setIpv4Destination(canonicalizedIpv4Prefix);

    matchBuilder.setLayer3Match(ipv4match.build());

    return matchBuilder;

}
 
开发者ID:opendaylight,项目名称:faas,代码行数:25,代码来源:OfMatchUtils.java


示例7: createSrcL3Ipv4MatchWithMac

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
/**
 * Creates a Match with src ip address mac address set.
 *
 * @param matchBuilder
 *            MatchBuilder Object
 * @param srcip
 *            String containing an IPv4 prefix
 * @param srcMac
 *            The source macAddress
 * @return matchBuilder Map Object with a match
 */
public static MatchBuilder createSrcL3Ipv4MatchWithMac(MatchBuilder matchBuilder, Ipv4Prefix srcip,
        MacAddress srcMac) {

    Ipv4MatchBuilder ipv4MatchBuilder = new Ipv4MatchBuilder();
    Ipv4Prefix canonicalizedIpv4Prefix = IpAddressUtils.canonicalizeIpPrefixToNetAddress(srcip);
    ipv4MatchBuilder.setIpv4Source(canonicalizedIpv4Prefix);
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(0x0800L));
    EthernetMatchBuilder eth = new EthernetMatchBuilder();
    eth.setEthernetType(ethTypeBuilder.build());
    eth.setEthernetSource(new EthernetSourceBuilder().setAddress(srcMac).build());

    matchBuilder.setLayer3Match(ipv4MatchBuilder.build());
    matchBuilder.setEthernetMatch(eth.build());
    return matchBuilder;

}
 
开发者ID:opendaylight,项目名称:faas,代码行数:29,代码来源:OfMatchUtils.java


示例8: addRemoteIpPrefix

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
/**
 * Adds remote Ip prefix to existing match.
 *
 * @param matchBuilder
 *            The match builder
 * @param sourceIpPrefix
 *            The source IP prefix
 * @param destIpPrefix
 *            The destination IP prefix
 * @return matchBuilder Map Object with a match
 */
public static MatchBuilder addRemoteIpPrefix(MatchBuilder matchBuilder, Ipv4Prefix sourceIpPrefix,
        Ipv4Prefix destIpPrefix) {
    Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
    if (null != sourceIpPrefix) {
        Ipv4Prefix canonicalizedSourceIpv4Prefix = IpAddressUtils.canonicalizeIpPrefixToNetAddress(sourceIpPrefix);
        ipv4match.setIpv4Source(canonicalizedSourceIpv4Prefix);
    }
    if (null != destIpPrefix) {
        Ipv4Prefix canonicalizedDestIpv4Prefix = IpAddressUtils.canonicalizeIpPrefixToNetAddress(destIpPrefix);
        ipv4match.setIpv4Destination(canonicalizedDestIpv4Prefix);
    }
    matchBuilder.setLayer3Match(ipv4match.build());

    return matchBuilder;
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:27,代码来源:OfMatchUtils.java


示例9: createIpAddressMatch

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
public static MatchBuilder createIpAddressMatch(MatchBuilder matchBuilder, String sourceIpv4, String destIpv4) {

        Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();

        if (sourceIpv4 != null) {
            Ipv4Prefix canonicalizedSourceIpv4Prefix = IpAddressUtils
                    .canonicalizeIpPrefixToNetAddress(new Ipv4Prefix(sourceIpv4));
            ipv4match.setIpv4Source(canonicalizedSourceIpv4Prefix);
        }

        if (destIpv4 != null) {
            Ipv4Prefix canonicalizedDestSourceIpv4Prefix = IpAddressUtils
                    .canonicalizeIpPrefixToNetAddress(new Ipv4Prefix(destIpv4));
            ipv4match.setIpv4Destination(canonicalizedDestSourceIpv4Prefix);
        }

        matchBuilder.setLayer3Match(ipv4match.build());
        return matchBuilder;
    }
 
开发者ID:opendaylight,项目名称:faas,代码行数:20,代码来源:OfMatchUtils.java


示例10: createNwSrcInstructions

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
/**
 * Create Set IPv4 Source Instruction
 *
 * @param ib        Map InstructionBuilder without any instructions
 * @param prefixsrc String containing an IPv4 prefix
 * @return ib Map InstructionBuilder with instructions
 */
public static InstructionBuilder createNwSrcInstructions(InstructionBuilder ib, Ipv4Prefix prefixsrc) {

    List<Action> actionList = new ArrayList<>();
    ActionBuilder ab = new ActionBuilder();

    SetNwSrcActionBuilder setNwsrcActionBuilder = new SetNwSrcActionBuilder();
    Ipv4Builder ipsrc = new Ipv4Builder();
    ipsrc.setIpv4Address(prefixsrc);
    setNwsrcActionBuilder.setAddress(ipsrc.build());
    ab.setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwsrcActionBuilder.build()).build());
    ab.setOrder(0);
    ab.setKey(new ActionKey(0));
    actionList.add(ab.build());

    // Create an Apply Action
    ApplyActionsBuilder aab = new ApplyActionsBuilder();
    aab.setAction(actionList);

    // Wrap our Apply Action in an Instruction
    ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());

    return ib;
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:31,代码来源:OfInstructionUtils.java


示例11: createDstArpIpInstructions

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
/**
 * Set ARP_TPA Instructions
 * @param ib Map InstructionBuilder
 * @param dstiparp the dstiparp
 * @return instructionbuilder with new attributes
 */
public static InstructionBuilder createDstArpIpInstructions(InstructionBuilder ib, Ipv4Prefix dstiparp) {

    List<Action> actionList = new ArrayList<>();
    ActionBuilder ab = new ActionBuilder();
    SetFieldBuilder setFieldBuilder = new SetFieldBuilder();

    ArpMatchBuilder arpmatch = new ArpMatchBuilder();
    arpmatch.setArpTargetTransportAddress(dstiparp);
    setFieldBuilder.setLayer3Match(arpmatch.build());
    ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
    ab.setOrder(0);
    ab.setKey(new ActionKey(0));
    actionList.add(ab.build());

    ApplyActionsBuilder aab = new ApplyActionsBuilder();
    aab.setAction(actionList);
    // Wrap our Apply Action in an Instruction
    ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());

    return ib;
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:28,代码来源:OfInstructionUtils.java


示例12: createSrcArpIpInstructions

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
/**
 * Set ARP_SPA Instructions
 * @param ib Map InstructionBuilder
 * @param srciparp the srciparp
 * @return instructionbuilder with new attributes
 */
public static InstructionBuilder createSrcArpIpInstructions(InstructionBuilder ib, Ipv4Prefix srciparp) {

    List<Action> actionList = new ArrayList<>();
    ActionBuilder ab = new ActionBuilder();
    SetFieldBuilder setFieldBuilder = new SetFieldBuilder();

    ArpMatchBuilder arpmatch = new ArpMatchBuilder();
    arpmatch.setArpSourceTransportAddress(srciparp);
    setFieldBuilder.setLayer3Match(arpmatch.build());
    ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
    ab.setOrder(0);
    ab.setKey(new ActionKey(0));
    actionList.add(ab.build());

    ApplyActionsBuilder aab = new ApplyActionsBuilder();
    aab.setAction(actionList);
    // Wrap our Apply Action in an Instruction
    ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());

    return ib;
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:28,代码来源:OfInstructionUtils.java


示例13: doExecute

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
@Override
protected Object doExecute() throws Exception {

    final UUID uuid = UUID.randomUUID();

    IntentLimiterBuilder intentLimiterBuilder = new IntentLimiterBuilder();
    intentLimiterBuilder.setId(new Uuid(uuid.toString()));
    intentLimiterBuilder.setAction(IntentLimiter.Action.DROP);
    intentLimiterBuilder.setDuration(Short.valueOf(during.split("-")[0]));
    intentLimiterBuilder.setDurationType(TimingType.valueOf(during.split("-")[1].toUpperCase()));
    intentLimiterBuilder.setInterval(Short.valueOf(withIntervalOf.split("-")[0]));
    intentLimiterBuilder.setIntervalType(TimingType.valueOf(withIntervalOf.split("-")[1].toUpperCase()));
    intentLimiterBuilder.setSourceIp(new Ipv4Prefix(dropPacketsFrom));
    intentLimiterBuilder.setBandwidthLimit(Long.valueOf(bandLimit.split("-")[0]));
    intentLimiterBuilder.setBandwidthLimitType(BandwidthCap.valueOf(bandLimit.split("-")[1].toUpperCase()));

    nicConsoleProvider.addIntent(intentLimiterBuilder.build());
    return intentLimiterBuilder.build();
}
 
开发者ID:opendaylight,项目名称:nic,代码行数:20,代码来源:IntentLimiterAddShellCommand.java


示例14: createMatch

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
private Match createMatch(Ipv4Prefix ipv4Prefix) {
    final Ipv4MatchBuilder ipv4MatchBuilder = new Ipv4MatchBuilder();
    ipv4MatchBuilder.setIpv4Source(ipv4Prefix);

    Layer3Match layer3Match = ipv4MatchBuilder.build();

    final MatchBuilder matchBuilder = new MatchBuilder();
    final EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder();
    final EthernetTypeBuilder ethernetTypeBuilder = new EthernetTypeBuilder();

    ethernetTypeBuilder.setType(new EtherType(ETHER_TYPE));
    ethernetMatchBuilder.setEthernetType(ethernetTypeBuilder.build());

    matchBuilder.setLayer3Match(layer3Match);
    matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());

    return matchBuilder.build();
}
 
开发者ID:opendaylight,项目名称:nic,代码行数:19,代码来源:OFRuleWithMeterManager.java


示例15: createFlowData

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
public Dataflow createFlowData(final IntentLimiter intent, final MeterId meterId) throws IntentInvalidException {
    final Ipv4Prefix sourceIp = intent.getSourceIp();
    DataflowBuilder dataflowBuilder = new DataflowBuilder();
    dataflowBuilder.setCreationTime(String.valueOf(System.currentTimeMillis()));
    dataflowBuilder.setIsFlowMeter(true);
    dataflowBuilder.setId(intent.getId());
    dataflowBuilder.setTimeout(intent.getDuration());
    dataflowBuilder.setDataflowMeterBandType(org.opendaylight.yang.gen.v1.urn.opendaylight.nic.renderer.api.dataflow
            .rev170309.Dataflow.DataflowMeterBandType.OFMBTDROP);
    dataflowBuilder.setMeterFlags(Dataflow.MeterFlags.METERKBPS);
    dataflowBuilder.setSourceIpAddress(sourceIp);
    dataflowBuilder.setRendererAction(Dataflow.RendererAction.ADD);
    dataflowBuilder.setBandwidthRate(intent.getBandwidthLimit());
    dataflowBuilder.setFlowType(Dataflow.FlowType.L3);
    dataflowBuilder.setMeterId(meterId.getValue().shortValue());
    dataflowBuilder.setStatus(Dataflow.Status.PROCESSING);
    dataflowBuilder.setIsRefreshable(true);
    return dataflowBuilder.build();
}
 
开发者ID:opendaylight,项目名称:nic,代码行数:20,代码来源:CommonUtils.java


示例16: createAttributes

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
private static Attributes createAttributes(final List<String> extCom, final boolean multiPathSupport,
        final Ipv4Prefix addressPrefix) {
    final AttributesBuilder attBuilder = new AttributesBuilder();
    attBuilder.setOrigin(new OriginBuilder().setValue(BgpOrigin.Egp).build());
    attBuilder.setAsPath(new AsPathBuilder().setSegments(Collections.emptyList()).build());
    attBuilder.setMultiExitDisc(new MultiExitDiscBuilder().setMed((long) 0).build());
    attBuilder.setLocalPref(new LocalPrefBuilder().setPref(100L).build());
    attBuilder.setExtendedCommunities(createExtComm(extCom));
    attBuilder.setUnrecognizedAttributes(Collections.emptyList());

    final Ipv4PrefixesBuilder prefixes = new Ipv4PrefixesBuilder().setPrefix(addressPrefix);
    if (multiPathSupport) {
        prefixes.setPathId(new PathId(5L));
    }
    attBuilder.addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(
            new MpReachNlriBuilder().setCNextHop(NEXT_HOP).setAfi(Ipv4AddressFamily.class)
                    .setSafi(UnicastSubsequentAddressFamily.class)
                    .setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
                            new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder()
                                    .setIpv4Prefixes(Collections.singletonList(prefixes.build())).build())
                                    .build()).build()).build()).build());

    return attBuilder.build();
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:25,代码来源:PrefixesBuilder.java


示例17: testGetUpdateMessage5

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
@Test
public void testGetUpdateMessage5() throws Exception {
    final byte[] body = ByteArray.cutBytes(inputBytes.get(4), MessageUtil.COMMON_HEADER_LENGTH);
    final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(4), MessageUtil.MARKER_LENGTH, LENGTH_FIELD_LENGTH));
    final Update message = BGPParserTest.updateParser.parseMessageBody(Unpooled.copiedBuffer(body), messageLength);

    // attributes
    final List<WithdrawnRoutes> withdrawnRoutes = Lists.newArrayList(new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("172.16.0.4/30")).build());

    // check API message
    final Update expectedMessage = new UpdateBuilder().setWithdrawnRoutes(withdrawnRoutes).build();

    assertEquals(expectedMessage.getWithdrawnRoutes(), message.getWithdrawnRoutes());

    final ByteBuf buffer = Unpooled.buffer();
    BGPParserTest.updateParser.serializeMessage(message, buffer);
    assertArrayEquals(inputBytes.get(4), ByteArray.readAllBytes(buffer));
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:19,代码来源:BGPParserTest.java


示例18: testUpdateMessageWithdrawAddPath

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
@Test
public void testUpdateMessageWithdrawAddPath() throws Exception {
    final byte[] body = ByteArray.cutBytes(updatesWithMultiplePath.get(1), MessageUtil.COMMON_HEADER_LENGTH);
    final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(updatesWithMultiplePath.get(1), MessageUtil.MARKER_LENGTH, LENGTH_FIELD_LENGTH));
    final Update message = BGPParserTest.updateParser.parseMessageBody(Unpooled.copiedBuffer(body), messageLength, constraint);

    // attributes
    final List<WithdrawnRoutes> withdrawnRoutes = Lists.newArrayList();
    withdrawnRoutes.add(new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("172.16.0.4/30")).setPathId(new PathId(1L)).build());
    withdrawnRoutes.add(new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("172.16.0.4/30")).setPathId(new PathId(2L)).build());

    // check API message
    final Update expectedMessage = new UpdateBuilder().setWithdrawnRoutes(withdrawnRoutes).build();

    assertEquals(expectedMessage.getWithdrawnRoutes(), message.getWithdrawnRoutes());

    final ByteBuf buffer = Unpooled.buffer();
    BGPParserTest.updateParser.serializeMessage(message, buffer);
    assertArrayEquals(updatesWithMultiplePath.get(1), ByteArray.readAllBytes(buffer));
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:21,代码来源:BGPParserTest.java


示例19: extractFlowspec

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
public static void extractFlowspec(final ChoiceNode fsType, final FlowspecBuilder fsBuilder) {
    if (fsType.getChild(AbstractFlowspecNlriParser.DEST_PREFIX_NID).isPresent()) {
        fsBuilder.setFlowspecType(
            new DestinationPrefixCaseBuilder()
                .setDestinationPrefix(
                    new Ipv4Prefix((String) fsType.getChild(AbstractFlowspecNlriParser.DEST_PREFIX_NID).get().getValue())
                ).build()
        );
    } else if (fsType.getChild(AbstractFlowspecNlriParser.SOURCE_PREFIX_NID).isPresent()) {
        fsBuilder.setFlowspecType(
            new SourcePrefixCaseBuilder()
                .setSourcePrefix(
                    new Ipv4Prefix((String) fsType.getChild(AbstractFlowspecNlriParser.SOURCE_PREFIX_NID).get().getValue())
                ).build()
        );
    } else if (fsType.getChild(PROTOCOL_IP_NID).isPresent()) {
        fsBuilder.setFlowspecType(new ProtocolIpCaseBuilder().setProtocolIps(createProtocolsIps((UnkeyedListNode) fsType.getChild(PROTOCOL_IP_NID).get())).build());
    }
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:20,代码来源:FlowspecIpv4NlriParserHelper.java


示例20: testExtractFlowspecDestPrefix

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; //导入依赖的package包/类
@Test
public void testExtractFlowspecDestPrefix() {
    final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
    entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
    entry.withChild(Builders.unkeyedListBuilder()
        .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
        .withChild(Builders.unkeyedListEntryBuilder()
            .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
            .withChild(Builders.choiceBuilder()
                .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
                .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.DEST_PREFIX_NID).withValue("127.0.0.5/32").build()).build()).build()).build());

    final FlowspecBuilder expectedFS = new FlowspecBuilder();
    expectedFS.setFlowspecType(new DestinationPrefixCaseBuilder().setDestinationPrefix(new Ipv4Prefix("127.0.0.5/32")).build());
    final List<Flowspec> expected = new ArrayList<>();
    expected.add(expectedFS.build());
    assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:19,代码来源:FlowspecL3vpnIpv4NlriParserTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JsonException类代码示例发布时间:2022-05-23
下一篇:
Java ExpressionManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap