Search in sources :

Example 46 with Ipv4Address

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address in project bgpcep by opendaylight.

the class RemoteNodeDescriptorTlvParser method parseTlvBody.

@Override
public RemoteNodeDescriptors parseTlvBody(final ByteBuf value) {
    final Map<QName, Object> parsedSubTlvs = new HashMap<>();
    final RemoteNodeDescriptorsBuilder builder = new RemoteNodeDescriptorsBuilder(parseNodeDescriptor(value, parsedSubTlvs));
    builder.setBgpRouterId((Ipv4Address) parsedSubTlvs.get(BgpRouterIdTlvParser.BGP_ROUTER_ID_QNAME));
    builder.setMemberAsn((AsNumber) parsedSubTlvs.get(MemAsNumTlvParser.MEMBER_AS_NUMBER_QNAME));
    return builder.build();
}
Also used : HashMap(java.util.HashMap) QName(org.opendaylight.yangtools.yang.common.QName) RemoteNodeDescriptorsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.object.type.link._case.RemoteNodeDescriptorsBuilder)

Example 47 with Ipv4Address

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address in project bgpcep by opendaylight.

the class AbstractLocalNodeDescriptorTlvCodec method parseTlvBody.

@Override
public final LocalNodeDescriptors parseTlvBody(final ByteBuf value) {
    final Map<QName, Object> parsedSubTlvs = new HashMap<>();
    final LocalNodeDescriptorsBuilder builder = new LocalNodeDescriptorsBuilder(parseNodeDescriptor(value, parsedSubTlvs));
    builder.setBgpRouterId((Ipv4Address) parsedSubTlvs.get(BgpRouterIdTlvParser.BGP_ROUTER_ID_QNAME));
    builder.setMemberAsn((AsNumber) parsedSubTlvs.get(MemAsNumTlvParser.MEMBER_AS_NUMBER_QNAME));
    return builder.build();
}
Also used : LocalNodeDescriptorsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.object.type.link._case.LocalNodeDescriptorsBuilder) HashMap(java.util.HashMap) QName(org.opendaylight.yangtools.yang.common.QName)

Example 48 with Ipv4Address

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address in project bgpcep by opendaylight.

the class AbstractAddPathTest method createSimpleUpdate.

private static Update createSimpleUpdate(final Ipv4Prefix prefix, final PathId pathId, final ClusterIdentifier clusterId, final long localPreference) {
    final AttributesBuilder attBuilder = new AttributesBuilder();
    attBuilder.setLocalPref(new LocalPrefBuilder().setPref(localPreference).build());
    attBuilder.setOrigin(new OriginBuilder().setValue(BgpOrigin.Igp).build());
    attBuilder.setAsPath(new AsPathBuilder().setSegments(Collections.emptyList()).build());
    if (clusterId != null) {
        attBuilder.setClusterId(new ClusterIdBuilder().setCluster(Collections.singletonList(clusterId)).build());
        attBuilder.setOriginatorId(new OriginatorIdBuilder().setOriginator(new Ipv4Address(clusterId)).build());
    }
    addAttributeAugmentation(attBuilder, prefix, pathId);
    return new UpdateBuilder().setAttributes(attBuilder.build()).build();
}
Also used : LocalPrefBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.LocalPrefBuilder) AsPathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.AsPathBuilder) OriginBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.OriginBuilder) UpdateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.UpdateBuilder) ClusterIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.ClusterIdBuilder) AttributesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder) OriginatorIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.OriginatorIdBuilder) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 49 with Ipv4Address

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address in project bgpcep by opendaylight.

the class AbstractAddPathTest method configurePeer.

protected static BGPPeer configurePeer(final Ipv4Address peerAddress, final RIBImpl ribImpl, final BgpParameters bgpParameters, final PeerRole peerRole, final BGPPeerRegistry bgpPeerRegistry) {
    final IpAddress ipAddress = new IpAddress(peerAddress);
    final BGPPeer bgpPeer = new BGPPeer(new IpAddress(peerAddress), ribImpl, peerRole, null, AFI_SAFIS_ADVERTIZED, Collections.emptySet());
    final List<BgpParameters> tlvs = Lists.newArrayList(bgpParameters);
    bgpPeerRegistry.addPeer(ipAddress, bgpPeer, new BGPSessionPreferences(AS_NUMBER, HOLDTIMER, new BgpId(RIB_ID), AS_NUMBER, tlvs));
    bgpPeer.instantiateServiceInstance();
    return bgpPeer;
}
Also used : BGPSessionPreferences(org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences) BgpId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) BgpParameters(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.BgpParameters)

Example 50 with Ipv4Address

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address in project bgpcep by opendaylight.

the class AbstractBGPDispatcherTest method createServer.

Channel createServer(final InetSocketAddress serverAddress) {
    this.registry.addPeer(new IpAddress(new Ipv4Address(serverAddress.getAddress().getHostAddress())), this.serverListener, createPreferences(serverAddress));
    LoggerFactory.getLogger(AbstractBGPDispatcherTest.class).info("createServer");
    final ChannelFuture future = this.serverDispatcher.createServer(serverAddress);
    future.addListener(future1 -> Preconditions.checkArgument(future1.isSuccess(), "Unable to start bgp server on %s", future1.cause()));
    waitFutureSuccess(future);
    return future.channel();
}
Also used : ChannelFuture(io.netty.channel.ChannelFuture) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Aggregations

Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)206 Test (org.junit.Test)116 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)59 ByteBuf (io.netty.buffer.ByteBuf)58 ArrayList (java.util.ArrayList)34 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)29 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)25 BigInteger (java.math.BigInteger)21 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)20 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)20 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)18 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder)18 Ipv4NextHopCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv4NextHopCaseBuilder)18 Ipv4NextHopBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.ipv4.next.hop._case.Ipv4NextHopBuilder)18 FlowWildcardsV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10)16 MatchV10Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder)14 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match)13 OriginBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.OriginBuilder)13 UpdateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.UpdateBuilder)12 ArpMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatch)11