throw new BGPParsingException("Router Id of invalid length " + value.length);
}
- private static PrefixDescriptors parsePrefixDescriptors(final NodeIdentifier localDescriptor, final byte[] bytes, final boolean ipv4)
- throws BGPParsingException {
+ private static PrefixDescriptors parsePrefixDescriptors(final byte[] bytes, final boolean ipv4) throws BGPParsingException {
int byteOffset = 0;
final PrefixDescriptorsBuilder builder = new PrefixDescriptorsBuilder();
while (byteOffset != bytes.length) {
parseLink(builder, ByteArray.subByte(nlri, byteOffset, restLength));
break;
case Ipv4Prefix:
- builder.setPrefixDescriptors(parsePrefixDescriptors(localDescriptor, ByteArray.subByte(nlri, byteOffset, restLength), true));
+ builder.setPrefixDescriptors(parsePrefixDescriptors(ByteArray.subByte(nlri, byteOffset, restLength), true));
break;
case Ipv6Prefix:
- builder.setPrefixDescriptors(parsePrefixDescriptors(localDescriptor, ByteArray.subByte(nlri, byteOffset, restLength), false));
+ builder.setPrefixDescriptors(parsePrefixDescriptors(ByteArray.subByte(nlri, byteOffset, restLength), false));
break;
case Node:
// node nlri is already parsed as it contains only the common fields for node and link nlri
private void handleOpen(final Open openObj) {
final List<BgpParameters> prefs = openObj.getBgpParameters();
- if (prefs != null && !prefs.isEmpty()) {
- if (prefs.containsAll(this.localPref.getParams())) {
- this.remotePref = openObj;
- this.writeMessage(new KeepaliveBuilder().build());
- this.session = new BGPSessionImpl(this.timer, this.listener, this.channel, this.remotePref);
- this.state = State.OpenConfirm;
- LOG.debug("Channel {} moved to OpenConfirm state with remote proposal {}", this.channel, this.remotePref);
- return;
- }
+ if (prefs != null && !prefs.isEmpty() && prefs.containsAll(this.localPref.getParams())) {
+ this.remotePref = openObj;
+ this.writeMessage(new KeepaliveBuilder().build());
+ this.session = new BGPSessionImpl(this.timer, this.listener, this.channel, this.remotePref);
+ this.state = State.OpenConfirm;
+ LOG.debug("Channel {} moved to OpenConfirm state with remote proposal {}", this.channel, this.remotePref);
+ return;
}
final Notify ntf = new NotifyBuilder().setErrorCode(BGPError.UNSPECIFIC_OPEN_ERROR.getCode()).setErrorSubcode(
BGPError.UNSPECIFIC_OPEN_ERROR.getSubcode()).build();
/**
*
*/
-public final class RIBExtensionsImplModule extends org.opendaylight.controller.config.yang.bgp.rib.spi.AbstractRIBExtensionsImplModule
-{
+public final class RIBExtensionsImplModule extends org.opendaylight.controller.config.yang.bgp.rib.spi.AbstractRIBExtensionsImplModule {
- public RIBExtensionsImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ public RIBExtensionsImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+ final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
}
- public RIBExtensionsImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final RIBExtensionsImplModule oldModule, final java.lang.AutoCloseable oldInstance) {
+ public RIBExtensionsImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+ final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final RIBExtensionsImplModule oldModule,
+ final java.lang.AutoCloseable oldInstance) {
super(identifier, dependencyResolver, oldModule, oldInstance);
}
@Override
- public void validate(){
+ public void validate() {
super.validate();
// Add custom validation for module attributes here.
}
final class RIBExtensionProviderContextImplCloseable extends SimpleRIBExtensionProviderContext implements AutoCloseable {
@Override
public void close() {
- for (RIBExtensionProviderActivator e : getExtensionDependency()) {
- e.stopRIBExtensionProvider();;
+ for (final RIBExtensionProviderActivator e : getExtensionDependency()) {
+ e.stopRIBExtensionProvider();
}
}
}
final RIBExtensionProviderContextImplCloseable ret = new RIBExtensionProviderContextImplCloseable();
- for (RIBExtensionProviderActivator e : getExtensionDependency()) {
+ for (final RIBExtensionProviderActivator e : getExtensionDependency()) {
e.startRIBExtensionProvider(ret);
}
private static final Logger LOG = LoggerFactory.getLogger(LinkstateTopologyBuilder.class);
public LinkstateTopologyBuilder(final DataProviderService dataProvider, final RibReference locRibReference, final TopologyId topologyId) {
- super(dataProvider, locRibReference, topologyId,
- new TopologyTypesBuilder().addAugmentation(TopologyTypes1.class, new TopologyTypes1Builder().build()).build(), LinkstateRoute.class);
+ super(dataProvider, locRibReference, topologyId, new TopologyTypesBuilder().addAugmentation(TopologyTypes1.class,
+ new TopologyTypes1Builder().build()).build(), LinkstateRoute.class);
}
private LinkId buildLinkId(final UriBuilder base, final LinkCase link) {
return new NodeId(new UriBuilder(base, "node").add("", node).toString());
}
- private TpId buildTpId(final UriBuilder base, final TopologyIdentifier topologyIdentifier, final Ipv4InterfaceIdentifier ipv4InterfaceIdentifier, final Ipv6InterfaceIdentifier ipv6InterfaceIdentifier, final byte[] bs) {
- return new TpId(new UriBuilder(base, "tp").add("mt", topologyIdentifier).add("ipv4", ipv4InterfaceIdentifier).add("ipv6", ipv6InterfaceIdentifier).add("id", bs).toString());
+ private TpId buildTpId(final UriBuilder base, final TopologyIdentifier topologyIdentifier,
+ final Ipv4InterfaceIdentifier ipv4InterfaceIdentifier, final Ipv6InterfaceIdentifier ipv6InterfaceIdentifier, final byte[] bs) {
+ return new TpId(new UriBuilder(base, "tp").add("mt", topologyIdentifier).add("ipv4", ipv4InterfaceIdentifier).add("ipv6",
+ ipv6InterfaceIdentifier).add("id", bs).toString());
}
private TpId buildLocalTpId(final UriBuilder base, final LinkDescriptors linkDescriptors) {
- return buildTpId(base, linkDescriptors.getMultiTopologyId(), linkDescriptors.getIpv4InterfaceAddress(), linkDescriptors.getIpv6InterfaceAddress(), linkDescriptors.getLinkLocalIdentifier());
+ return buildTpId(base, linkDescriptors.getMultiTopologyId(), linkDescriptors.getIpv4InterfaceAddress(),
+ linkDescriptors.getIpv6InterfaceAddress(), linkDescriptors.getLinkLocalIdentifier());
}
private TerminationPoint buildTp(final TpId id, final TerminationPointType type) {
stpb.setTpId(id);
if (type != null) {
- stpb.addAugmentation(TerminationPoint1.class, new TerminationPoint1Builder().setIgpTerminationPointAttributes(new IgpTerminationPointAttributesBuilder().setTerminationPointType(null).build()).build());
+ stpb.addAugmentation(
+ TerminationPoint1.class,
+ new TerminationPoint1Builder().setIgpTerminationPointAttributes(
+ new IgpTerminationPointAttributesBuilder().setTerminationPointType(null).build()).build());
}
return stpb.build();
}
- private TerminationPointType getTpType(final Ipv4InterfaceIdentifier ipv4InterfaceIdentifier, final Ipv6InterfaceIdentifier ipv6InterfaceIdentifier, final byte[] bs) {
+ private TerminationPointType getTpType(final Ipv4InterfaceIdentifier ipv4InterfaceIdentifier,
+ final Ipv6InterfaceIdentifier ipv6InterfaceIdentifier, final byte[] bs) {
// Order of preference: Unnumbered first, then IP
if (bs != null) {
final long id = UnsignedInteger.fromIntBits(ByteArray.bytesToInt(bs)).longValue();
private TerminationPoint buildLocalTp(final UriBuilder base, final LinkDescriptors linkDescriptors) {
final TpId id = buildLocalTpId(base, linkDescriptors);
- final TerminationPointType t = getTpType(linkDescriptors.getIpv4InterfaceAddress(), linkDescriptors.getIpv6InterfaceAddress(), linkDescriptors.getLinkLocalIdentifier());
+ final TerminationPointType t = getTpType(linkDescriptors.getIpv4InterfaceAddress(), linkDescriptors.getIpv6InterfaceAddress(),
+ linkDescriptors.getLinkLocalIdentifier());
return buildTp(id, t);
}
private TpId buildRemoteTpId(final UriBuilder base, final LinkDescriptors linkDescriptors) {
- return buildTpId(base, linkDescriptors.getMultiTopologyId(), linkDescriptors.getIpv4NeighborAddress(), linkDescriptors.getIpv6NeighborAddress(), linkDescriptors.getLinkRemoteIdentifier());
+ return buildTpId(base, linkDescriptors.getMultiTopologyId(), linkDescriptors.getIpv4NeighborAddress(),
+ linkDescriptors.getIpv6NeighborAddress(), linkDescriptors.getLinkRemoteIdentifier());
}
private TerminationPoint buildRemoteTp(final UriBuilder base, final LinkDescriptors linkDescriptors) {
final TpId id = buildRemoteTpId(base, linkDescriptors);
- final TerminationPointType t = getTpType(linkDescriptors.getIpv4NeighborAddress(), linkDescriptors.getIpv6NeighborAddress(), linkDescriptors.getLinkRemoteIdentifier());
+ final TerminationPointType t = getTpType(linkDescriptors.getIpv4NeighborAddress(), linkDescriptors.getIpv6NeighborAddress(),
+ linkDescriptors.getLinkRemoteIdentifier());
return buildTp(id, t);
}
ilab.setMultiTopologyId(topologyIdentifier.getValue().shortValue());
}
- return new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.IgpLinkAttributes1Builder().setIsisLinkAttributes(ilab.build()).build();
+ return new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.IgpLinkAttributes1Builder().setIsisLinkAttributes(
+ ilab.build()).build();
}
private org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.IgpLinkAttributes1 ospfLinkAttributes(
ilab.setMultiTopologyId(topologyIdentifier.getValue().shortValue());
}
- return new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.IgpLinkAttributes1Builder().setOspfLinkAttributes(ilab.build()).build();
+ return new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.IgpLinkAttributes1Builder().setOspfLinkAttributes(
+ ilab.build()).build();
}
- private void createLink(final DataModification<InstanceIdentifier<?>, DataObject> trans, final UriBuilder base, final LinkstateRoute value,
- final LinkCase l, final Attributes attributes) {
- final LinkAttributes la =
- ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev131125.bgp.rib.rib.loc.rib.tables.routes.linkstate.routes._case.linkstate.routes.linkstate.route.attributes.attribute.type.LinkCase) attributes.getAugmentation(Attributes1.class).getAttributeType()).getLinkAttributes();
+ private void createLink(final DataModification<InstanceIdentifier<?>, DataObject> trans, final UriBuilder base,
+ final LinkstateRoute value, final LinkCase l, final Attributes attributes) {
+ final LinkAttributes la = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev131125.bgp.rib.rib.loc.rib.tables.routes.linkstate.routes._case.linkstate.routes.linkstate.route.attributes.attribute.type.LinkCase) attributes.getAugmentation(
+ Attributes1.class).getAttributeType()).getLinkAttributes();
final IgpLinkAttributesBuilder ilab = new IgpLinkAttributesBuilder();
ilab.setMetric(la.getMetric().getValue());
private org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.IgpNodeAttributes1 ospfNodeAttributes(
final NodeAttributes na) {
+ // FIXME: write appropriate reason,why the parameter should be kept here although it is unused
final org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.node.attributes.ospf.node.attributes.TedBuilder tb = new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.node.attributes.ospf.node.attributes.TedBuilder();
final OspfNodeAttributesBuilder ab = new OspfNodeAttributesBuilder();
ab.build()).build();
}
- private void createNode(final DataModification<InstanceIdentifier<?>, DataObject> trans, final UriBuilder base, final LinkstateRoute value,
- final NodeCase n, final Attributes attributes) {
- final NodeAttributes na =
- ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev131125.bgp.rib.rib.loc.rib.tables.routes.linkstate.routes._case.linkstate.routes.linkstate.route.attributes.attribute.type.NodeCase) attributes.getAugmentation(Attributes1.class).getAttributeType()).getNodeAttributes();
+ private void createNode(final DataModification<InstanceIdentifier<?>, DataObject> trans, final UriBuilder base,
+ final LinkstateRoute value, final NodeCase n, final Attributes attributes) {
+ final NodeAttributes na = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev131125.bgp.rib.rib.loc.rib.tables.routes.linkstate.routes._case.linkstate.routes.linkstate.route.attributes.attribute.type.NodeCase) attributes.getAugmentation(
+ Attributes1.class).getAttributeType()).getNodeAttributes();
final List<IpAddress> ids = new ArrayList<>();
if (na.getIpv4RouterId() != null) {
final UriBuilder base, final PrefixCase p) {
return nodeIdentifierBuilder(base, p.getAdvertisingNodeDescriptors()).augmentation(Node1.class).child(
org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.node.attributes.IgpNodeAttributes.class).child(
- org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.node.attributes.igp.node.attributes.Prefix.class,
- new PrefixKey(p.getIpReachabilityInformation())).toInstance();
+ org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.node.attributes.igp.node.attributes.Prefix.class,
+ new PrefixKey(p.getIpReachabilityInformation())).toInstance();
}
private void createPrefix(final DataModification<InstanceIdentifier<?>, DataObject> trans, final UriBuilder base,
final LinkstateRoute value, final PrefixCase p, final Attributes attributes) {
- final PrefixAttributes pa =
- ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev131125.bgp.rib.rib.loc.rib.tables.routes.linkstate.routes._case.linkstate.routes.linkstate.route.attributes.attribute.type.PrefixCase) attributes.getAugmentation(Attributes1.class).getAttributeType()).getPrefixAttributes();
+ final PrefixAttributes pa = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev131125.bgp.rib.rib.loc.rib.tables.routes.linkstate.routes._case.linkstate.routes.linkstate.route.attributes.attribute.type.PrefixCase) attributes.getAugmentation(
+ Attributes1.class).getAttributeType()).getPrefixAttributes();
final PrefixBuilder pb = new PrefixBuilder();
pb.setPrefix(p.getIpReachabilityInformation());
private final StringBuilder sb;
UriBuilder(final UriBuilder base, final String type) {
- sb = new StringBuilder(base.sb);
- sb.append("type=").append(type);
+ this.sb = new StringBuilder(base.sb);
+ this.sb.append("type=").append(type);
}
UriBuilder(final LinkstateRoute route) {
- sb = new StringBuilder("bgpls://");
+ this.sb = new StringBuilder("bgpls://");
if (route.getDistinguisher() != null) {
- sb.append(route.getDistinguisher().getValue().toString()).append(':');
+ this.sb.append(route.getDistinguisher().getValue().toString()).append(':');
}
- sb.append(route.getProtocolId().toString()).append(':').append(route.getIdentifier().getValue().toString()).append('/');
+ this.sb.append(route.getProtocolId().toString()).append(':').append(route.getIdentifier().getValue().toString()).append('/');
}
UriBuilder add(final String name, final Object value) {
if (value != null) {
- sb.append('&').append(name).append('=').append(value.toString());
+ this.sb.append('&').append(name).append('=').append(value.toString());
}
return this;
}
UriBuilder add(final String prefix, final NodeIdentifier node) {
add(prefix + "as", node.getAsNumber());
add(prefix + "domain", node.getDomainId());
- add(prefix + "area", node.getAreaId());;
+ add(prefix + "area", node.getAreaId());
add(prefix + "router", node.getCRouterIdentifier());
return this;
}
@Override
public String toString() {
- final String ret = sb.toString();
+ final String ret = this.sb.toString();
LOG.trace("New URI {}", ret);
return ret;
}
@GuardedBy("this")
private Future<?> pending;
- ProtocolSessionPromise(final EventExecutor executor, final InetSocketAddress address, final ReconnectStrategy strategy, final Bootstrap b) {
+ ProtocolSessionPromise(final EventExecutor executor, final InetSocketAddress address, final ReconnectStrategy strategy,
+ final Bootstrap b) {
super(executor);
this.strategy = Preconditions.checkNotNull(strategy);
this.address = Preconditions.checkNotNull(address);
LOG.debug("Promise {} connection resolved", lock);
// Triggered when a connection attempt is resolved.
- Preconditions.checkState(ProtocolSessionPromise.this.pending == cf);
+ Preconditions.checkState(ProtocolSessionPromise.this.pending.equals(cf));
/*
* The promise we gave out could have been cancelled,
}
if (!cf.isSuccess()) {
- LOG.info("Attempt to connect to connect to {} failed", address, cf.cause());
+ LOG.info("Attempt to connect to connect to {} failed", ProtocolSessionPromise.this.address, cf.cause());
final Future<Void> rf = ProtocolSessionPromise.this.strategy.scheduleReconnect(cf.cause());
rf.addListener(new FutureListener<Void>() {
@Override
public void operationComplete(final Future<Void> sf) {
synchronized (lock) {
// Triggered when a connection attempt is to be made.
- Preconditions.checkState(ProtocolSessionPromise.this.pending == sf);
+ Preconditions.checkState(ProtocolSessionPromise.this.pending.equals(sf));
/*
* The promise we gave out could have been cancelled,
if (object == null) {
throw new IllegalArgumentException("Null object passed.");
}
-
final ObjectSerializer serializer = this.registry.getObjectSerializer(object);
-
- final byte[] retBytes = serializer.serializeObject(object);
- return retBytes;
+ return serializer.serializeObject(object);
}
private List<Object> parseObjects(final byte[] bytes) throws PCEPDeserializerException {
public List<Message> messages = Lists.newArrayList();
- private static final Logger logger = LoggerFactory.getLogger(SimpleSessionListener.class);
+ private static final Logger LOG = LoggerFactory.getLogger(SimpleSessionListener.class);
public SimpleSessionListener() {
}
@Override
public void onMessage(final PCEPSession session, final Message message) {
- logger.debug("Received message: {}", message);
+ LOG.debug("Received message: {}", message);
this.messages.add(message);
}
@Override
public void onSessionUp(final PCEPSession session) {
- logger.debug("Session up.");
+ LOG.debug("Session up.");
}
@Override
public void onSessionDown(final PCEPSession session, final Exception e) {
- logger.debug("Session down with cause : {} or exception: {}", e);
+ LOG.debug("Session down with cause : {} or exception: {}", e);
session.close();
}
@Override
public void onSessionTerminated(final PCEPSession session, final PCEPTerminationReason cause) {
- logger.debug("Session terminated. Cause : {}", cause.toString());
+ LOG.debug("Session terminated. Cause : {}", cause.toString());
}
}
public boolean up = false;
- private static final Logger logger = LoggerFactory.getLogger(TestingSessionListener.class);
+ private static final Logger LOG = LoggerFactory.getLogger(TestingSessionListener.class);
public TestingSessionListener() {
}
@Override
public void onMessage(final PCEPSession session, final Message message) {
- logger.debug("Received message: {}", message);
+ LOG.debug("Received message: {}", message);
this.messages.add(message);
}
@Override
public void onSessionUp(final PCEPSession session) {
- logger.debug("Session up.");
+ LOG.debug("Session up.");
this.up = true;
}
@Override
public void onSessionDown(final PCEPSession session, final Exception e) {
- logger.debug("Session down. Cause : {} or {}", e);
+ LOG.debug("Session down. Cause : {} or {}", e);
this.up = false;
}
@Override
public void onSessionTerminated(final PCEPSession session, final PCEPTerminationReason cause) {
- logger.debug("Session terminated. Cause : {}", cause);
+ LOG.debug("Session terminated. Cause : {}", cause);
}
public List<Message> messages() {