@Override
public void stop() {
- // TODO Auto-generated method stub
+ // FIXME: BUG-194
}
}
* @see <a href="http://tools.ietf.org/html/draft-gredler-idr-ls-distribution-03">BGP-LS draft</a>
*/
public class LinkstateAttributeParser implements AttributeParser {
- // FIXME: update to IANA number once it is known
+ // TODO: replace with actual values by IANA
public static final int TYPE = 99;
private static final Logger logger = LoggerFactory.getLogger(LinkstateAttributeParser.class);
return new COspfNodeBuilder().setOspfNode(new OspfNodeBuilder().setOspfRouterId(ByteArray.subByte(value, 0, 4)).build()).build();
}
if (value.length == 8) {
- final byte[] o = ByteArray.subByte(value, 0, 4); // FIXME: OSPFv3 vs OSPFv2
+ final byte[] o = ByteArray.subByte(value, 0, 4);
final OspfInterfaceIdentifier a = new OspfInterfaceIdentifier(ByteArray.subByte(value, 4, 4));
return new COspfPseudonodeBuilder().setOspfPseudonode(new OspfPseudonodeBuilder().setOspfRouterId(o).setLanInterface(a).build()).build();
}
final AsNumber as = new AsNumber(ByteArray.bytesToLong(ByteArray.subByte(body, offset, AS_SIZE)));
offset += AS_SIZE;
- // TODO: BAD_PEER_AS Error: when is an AS unacceptable?
-
final short holdTime = ByteArray.bytesToShort(ByteArray.subByte(body, offset, HOLD_TIME_SIZE));
offset += HOLD_TIME_SIZE;
if (holdTime == 1 || holdTime == 2) {
tt.put(t, true);
tt.put(t1, false);
- // FIXME: revive test for graceful capability tlv
+ // FIXME: BUG-196: revive test for graceful capability tlv
// final BGPParameter tlv3 = new GracefulCapability(false, 0, tt);
final CParameters tlv4 = new CAs4BytesBuilder().setAs4BytesCapability(
/**
-* Generated file
+ * Generated file
-* Generated from: yang module name: config-bgp-parser-spi yang module local name: bgp-extensions-impl
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Mon Nov 18 10:44:24 CET 2013
-*
-* Do not modify this file unless it is present under src/main directory
-*/
+ * Generated from: yang module name: config-bgp-parser-spi yang module local name: bgp-extensions-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Mon Nov 18 10:44:24 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
package org.opendaylight.controller.config.yang.bgp.parser.spi;
/**
*
*/
-public final class SimpleBGPExtensionProviderContextModule extends org.opendaylight.controller.config.yang.bgp.parser.spi.AbstractSimpleBGPExtensionProviderContextModule
-{
+public final class SimpleBGPExtensionProviderContextModule extends
+ org.opendaylight.controller.config.yang.bgp.parser.spi.AbstractSimpleBGPExtensionProviderContextModule {
- public SimpleBGPExtensionProviderContextModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
+ public SimpleBGPExtensionProviderContextModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+ org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
- public SimpleBGPExtensionProviderContextModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, SimpleBGPExtensionProviderContextModule oldModule, java.lang.AutoCloseable oldInstance) {
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
+ public SimpleBGPExtensionProviderContextModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+ org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+ SimpleBGPExtensionProviderContextModule oldModule, java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
- @Override
- public void validate(){
- super.validate();
- // Add custom validation for module attributes here.
- }
+ @Override
+ public void validate() {
+ super.validate();
+ // Add custom validation for module attributes here.
+ }
- @Override
- public java.lang.AutoCloseable createInstance() {
- //TODO:implement
- throw new java.lang.UnsupportedOperationException("Unimplemented stub method");
- }
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ // FIXME: BUG-188: implement
+ throw new java.lang.UnsupportedOperationException("Unimplemented stub method");
+ }
}
protected abstract byte[] serializeMessageImpl(final Notification message);
+ private final static byte[] MARKER;
+
+ static {
+ MARKER = new byte[MessageUtil.MARKER_LENGTH];
+ Arrays.fill(MARKER, (byte) 0xff);
+ }
+
@Override
public final Notification parseMessage(final byte[] bytes) throws BGPDocumentedException, BGPParsingException {
if (bytes == null) {
+ MessageUtil.COMMON_HEADER_LENGTH + ".");
}
final byte[] marker = ByteArray.subByte(bytes, 0, MessageUtil.MARKER_LENGTH);
- final byte[] ones = new byte[MessageUtil.MARKER_LENGTH];
- Arrays.fill(ones, (byte) 0xff);
- // TODO: possible refactor
- // if (Arrays.equals(marker, ones)) {
- // throw new BGPDocumentedException("Marker not set to ones.", BGPError.CONNECTION_NOT_SYNC);
- // }
+
+ if (!Arrays.equals(marker, MARKER)) {
+ throw new BGPDocumentedException("Marker not set to ones.", BGPError.CONNECTION_NOT_SYNC);
+ }
final byte[] bs = ByteArray.cutBytes(bytes, MessageUtil.MARKER_LENGTH);
final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(bs, 0, MessageUtil.LENGTH_FIELD_LENGTH));
final int messageType = UnsignedBytes.toInt(bs[MessageUtil.LENGTH_FIELD_LENGTH]);
}
private void cleanup() {
- // FIXME: support graceful restart
+ // FIXME: BUG-196: support graceful restart
for (final TablesKey key : this.tables) {
this.rib.clearTable(this, key);
}
if (prefs != null && !prefs.isEmpty()) {
for (final BgpParameters param : openObj.getBgpParameters()) {
final CParameters cap = param.getCParameters();
- // FIXME: the reference to linkstate should be moved to config subsystem!
+ // FIXME: BUG-199: the reference to linkstate should be moved to config subsystem!
if (cap instanceof CMultiprotocol
&& ((CMultiprotocol) cap).getMultiprotocolCapability().getAfi() == LinkstateAddressFamily.class
this.as = as;
this.bgpId = bgpId;
- // FIXME: the reference to linkstate should be moved to config subsystem!
+ // FIXME: BUG-199: the reference to linkstate should be moved to config subsystem!
final List<BgpParameters> tlvs = Lists.newArrayList();
tlvs.add(new BgpParametersBuilder().setCParameters(
new CMultiprotocolBuilder().setMultiprotocolCapability(
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.JdkFutureAdapters;
-public abstract class AbstractTopologyBuilder<T extends Route> implements AutoCloseable, DataChangeListener, LocRIBListener, TopologyReference {
+public abstract class AbstractTopologyBuilder<T extends Route> implements AutoCloseable, DataChangeListener, LocRIBListener,
+ TopologyReference {
private static final InstanceIdentifier<LocRib> locRIBPath = InstanceIdentifier.builder(LocRib.class).toInstance();
private static final Logger LOG = LoggerFactory.getLogger(AbstractTopologyBuilder.class);
private final InstanceIdentifier<Topology> topology;
this.idClass = Preconditions.checkNotNull(idClass);
}
- public static final InstanceIdentifier<Tables> tableInstanceIdentifier(
- final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) {
+ public static final InstanceIdentifier<Tables> tableInstanceIdentifier(final Class<? extends AddressFamily> afi,
+ final Class<? extends SubsequentAddressFamily> safi) {
return InstanceIdentifier.builder(locRIBPath).child(Tables.class, new TablesKey(afi, safi)).toInstance();
}
protected abstract void createObject(DataModification<InstanceIdentifier<?>, DataObject> trans, InstanceIdentifier<T> id, T value);
+
protected abstract void removeObject(DataModification<InstanceIdentifier<?>, DataObject> trans, InstanceIdentifier<T> id, T value);
public final DataProviderService getDataProvider() {
- return dataProvider;
+ return this.dataProvider;
}
@Override
public final InstanceIdentifier<Topology> getInstanceIdentifier() {
- return topology;
+ return this.topology;
}
@Override
final Set<InstanceIdentifier<T>> ids = new HashSet<>();
for (final InstanceIdentifier<?> i : event.getRemovedOperationalData()) {
- ids.add(Preconditions.checkNotNull(i.firstIdentifierOf(idClass)));
+ ids.add(Preconditions.checkNotNull(i.firstIdentifierOf(this.idClass)));
}
for (final InstanceIdentifier<?> i : event.getUpdatedOperationalData().keySet()) {
- ids.add(Preconditions.checkNotNull(i.firstIdentifierOf(idClass)));
+ ids.add(Preconditions.checkNotNull(i.firstIdentifierOf(this.idClass)));
}
for (final InstanceIdentifier<?> i : event.getCreatedOperationalData().keySet()) {
- ids.add(Preconditions.checkNotNull(i.firstIdentifierOf(idClass)));
+ ids.add(Preconditions.checkNotNull(i.firstIdentifierOf(this.idClass)));
}
final Map<InstanceIdentifier<?>, DataObject> o = event.getOriginalOperationalData();
final Map<InstanceIdentifier<?>, DataObject> n = event.getUpdatedOperationalData();
for (final InstanceIdentifier<T> i : ids) {
- final T oldValue = idClass.cast(o.get(i));
- final T newValue = idClass.cast(n.get(i));
+ final T oldValue = this.idClass.cast(o.get(i));
+ final T newValue = this.idClass.cast(n.get(i));
LOG.debug("Updating object {} value {} -> {}", i, oldValue, newValue);
if (oldValue != null) {
}
}
- Futures.addCallback(JdkFutureAdapters.listenInPoolThread(trans.commit()),
- new FutureCallback<RpcResult<TransactionStatus>>() {
+ Futures.addCallback(JdkFutureAdapters.listenInPoolThread(trans.commit()), new FutureCallback<RpcResult<TransactionStatus>>() {
@Override
public void onSuccess(final RpcResult<TransactionStatus> result) {
// Nothing to do
@Override
public final void close() throws InterruptedException, ExecutionException {
- final DataModificationTransaction trans = dataProvider.beginTransaction();
+ final DataModificationTransaction trans = this.dataProvider.beginTransaction();
trans.removeOperationalData(getInstanceIdentifier());
trans.commit().get();
}
@Override
public final void onDataChanged(final DataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
- final DataModificationTransaction trans = dataProvider.beginTransaction();
+ final DataModificationTransaction trans = this.dataProvider.beginTransaction();
try {
onLocRIBChange(trans, change);
- } catch (RuntimeException e) {
+ } catch (final RuntimeException e) {
LOG.info("Data change {} was not completely propagated to listener {}", change, this, e);
}
- // FIXME: abort the transaction if it's not committing?
+ // FIXME: BUG-198: abort the transaction if it's not committing?
}
}
});
} else {
/*
- * FIXME: we have a slight race window with cancellation
+ * FIXME: BUG-190: we have a slight race window with cancellation
* here. Analyze and define its semantics.
*/
ReconnectPromise.this.strategy.reconnectSuccessful();
synchronized (lock) {
if (AbstractPCEPSessionNegotiatorFactory.this.sessions.containsKey(clientAddress)) {
- // FIXME: cross-reference this to RFC5440
-
final byte[] serverAddress = ((InetSocketAddress) this.channel.localAddress()).getAddress().getAddress();
if (comparator.compare(serverAddress, clientAddress) > 0) {
final Closeable n = AbstractPCEPSessionNegotiatorFactory.this.sessions.remove(clientAddress);
@GuardedBy("this")
private short nextSession(final byte[] clientAddress) {
/*
- * FIXME: Improve the allocation algorithm to make sure:
+ * FIXME: BUG-197: Improve the allocation algorithm to make sure:
* - no duplicate IDs are assigned
* - we retain former session IDs for a reasonable time
*/
import java.io.IOException;
public interface PCEPSessionRuntimeMXBean {
- //TODO remove once operations are generated
+ // FIXME: BUG-194: remove once operations are generated
Integer getDeadTimerValue();
this.fillIn(new PCEPErrorIdentifier((short) 19, (short) 1), PCEPErrors.UPDATE_REQ_FOR_NON_LSP);
this.fillIn(new PCEPErrorIdentifier((short) 19, (short) 2), PCEPErrors.UPDATE_REQ_FOR_NO_STATEFUL);
- // TODO: value TBD
+ // TODO: replace with actual values by IANA
this.fillIn(new PCEPErrorIdentifier((short) 19, (short) 3), PCEPErrors.UNKNOWN_PLSP_ID);
this.fillIn(new PCEPErrorIdentifier((short) 19, (short) 4), PCEPErrors.LSP_LIMIT_EXCEEDED);
return ret;
}
- boolean foundClass = false;
+ final boolean foundClass = false;
- // FIXME: search the parsers, check classes
+ // FIXME: BUG-187: search the parsers, check classes
if (!foundClass) {
return new ObjectParser() {
this.network = Preconditions.checkNotNull(network);
}
- public static PCEPTopologyProvider create(final PCEPDispatcher dispatcher,
- final InetSocketAddress address,
- final InstructionScheduler scheduler,
- final DataProviderService dataService,
- final InstanceIdentifier<Topology> topology) throws InterruptedException, ExecutionException {
+ public static PCEPTopologyProvider create(final PCEPDispatcher dispatcher, final InetSocketAddress address,
+ final InstructionScheduler scheduler, final DataProviderService dataService, final InstanceIdentifier<Topology> topology)
+ throws InterruptedException, ExecutionException {
final ServerSessionManager manager = new ServerSessionManager(dataService, topology);
final TopologyRPCs element = new TopologyRPCs(manager);
final TopologyProgramming network = new TopologyProgramming(scheduler, manager);
- ChannelFuture f = dispatcher.createServer(address, manager);
+ final ChannelFuture f = dispatcher.createServer(address, manager);
f.get();
return new PCEPTopologyProvider(f.channel(), topology, manager, element, network);
}
@Override
public void close() throws Exception {
- channel.close();
- // FIXME: close other stuff
+ this.channel.close();
+ // FIXME: BUG-193: close other stuff
}
}
final SymbolicPathName name = tlvs.getSymbolicPathName();
if (name == null) {
LOG.error("PLSPID {} seen for the first time, not reporting the LSP", id);
- // TODO: what should we do here?
+ // FIXME: BUG-189
continue;
}
this.lsps.put(id, name);
}
// Make sure the LSP exists
- final InstanceIdentifier<ReportedLsps> lsp = InstanceIdentifier.builder(l.topologyAugment).
- child(PathComputationClient.class).
- child(ReportedLsps.class, new ReportedLspsKey(input.getName())).toInstance();
+ final InstanceIdentifier<ReportedLsps> lsp = InstanceIdentifier.builder(l.topologyAugment).child(PathComputationClient.class).child(
+ ReportedLsps.class, new ReportedLspsKey(input.getName())).toInstance();
LOG.debug("Checking if LSP {} has operational state {}", lsp, input.getArguments().getOperational());
final ReportedLsps rep = (ReportedLsps) this.dataProvider.readOperationalData(lsp);
if (rep == null) {
this.target = Preconditions.checkNotNull(target);
}
- private static void categorizeIdentifier(final InstanceIdentifier<?> i,
- final Set<InstanceIdentifier<ReportedLsps>> changedLsps,
+ private static void categorizeIdentifier(final InstanceIdentifier<?> i, final Set<InstanceIdentifier<ReportedLsps>> changedLsps,
final Set<InstanceIdentifier<Node>> changedNodes) {
final InstanceIdentifier<ReportedLsps> li = i.firstIdentifierOf(ReportedLsps.class);
if (li == null) {
}
for (final ReportedLsps l : pccnode.getPathComputationClient().getReportedLsps()) {
- lsps.add(InstanceIdentifier.builder(id).
- augmentation(Node1.class).
- child(PathComputationClient.class).
- child(ReportedLsps.class, l.getKey()).toInstance());
+ lsps.add(InstanceIdentifier.builder(id).augmentation(Node1.class).child(PathComputationClient.class).child(ReportedLsps.class,
+ l.getKey()).toInstance());
}
}
}
private InstanceIdentifier<Link> linkForLsp(final LinkId linkId) {
- return InstanceIdentifier.builder(target).child(Link.class, new LinkKey(linkId)).toInstance();
+ return InstanceIdentifier.builder(this.target).child(Link.class, new LinkKey(linkId)).toInstance();
}
private SupportingNode createSupportingNode(final NodeId sni, final Boolean inControl) {
final SupportingNodeBuilder snb = new SupportingNodeBuilder();
snb.setNodeRef(sni);
snb.setKey(sk);
- snb.addAugmentation(SupportingNode1.class, new SupportingNode1Builder().setPathComputationClient(
- new PathComputationClientBuilder().setControlling(inControl).build()).build());
+ snb.addAugmentation(
+ SupportingNode1.class,
+ new SupportingNode1Builder().setPathComputationClient(new PathComputationClientBuilder().setControlling(inControl).build()).build());
return snb.build();
}
- private InstanceIdentifier<TerminationPoint> getIpTerminationPoint(final DataModificationTransaction trans, final IpAddress addr, final InstanceIdentifier<Node> sni, final Boolean inControl) {
- for (final Node n : ((Topology) trans.readOperationalData(target)).getNode()) {
+ private InstanceIdentifier<TerminationPoint> getIpTerminationPoint(final DataModificationTransaction trans, final IpAddress addr,
+ final InstanceIdentifier<Node> sni, final Boolean inControl) {
+ for (final Node n : ((Topology) trans.readOperationalData(this.target)).getNode()) {
for (final TerminationPoint tp : n.getTerminationPoint()) {
final TerminationPoint1 tpa = tp.getAugmentation(TerminationPoint1.class);
* so it does not have a supporting node pointer. Since we now know what it is,
* fill it in.
*/
- for (SupportingNode sn : n.getSupportingNode()) {
+ for (final SupportingNode sn : n.getSupportingNode()) {
if (sn.getNodeRef().equals(k.getNodeId())) {
have = true;
break;
if (!have) {
final SupportingNode sn = createSupportingNode(k.getNodeId(), inControl);
- trans.putOperationalData(InstanceIdentifier.builder(target).
- child(Node.class, n.getKey()).
- child(SupportingNode.class, sn.getKey()).toInstance(), sn);
+ trans.putOperationalData(
+ InstanceIdentifier.builder(this.target).child(Node.class, n.getKey()).child(
+ SupportingNode.class, sn.getKey()).toInstance(), sn);
}
}
- return InstanceIdentifier.builder(target).child(Node.class, n.getKey()).child(TerminationPoint.class, tp.getKey()).toInstance();
+ return InstanceIdentifier.builder(this.target).child(Node.class, n.getKey()).child(TerminationPoint.class,
+ tp.getKey()).toInstance();
}
}
} else {
final TerminationPointKey tpk = new TerminationPointKey(new TpId(url));
final TerminationPointBuilder tpb = new TerminationPointBuilder();
tpb.setKey(tpk).setTpId(tpk.getTpId());
- tpb.addAugmentation(TerminationPoint1.class,
- new TerminationPoint1Builder().
- setIgpTerminationPointAttributes(
- new IgpTerminationPointAttributesBuilder().
- setTerminationPointType(new IpBuilder().setIpAddress(Lists.newArrayList(addr)).build()).build()).build());
+ tpb.addAugmentation(
+ TerminationPoint1.class,
+ new TerminationPoint1Builder().setIgpTerminationPointAttributes(
+ new IgpTerminationPointAttributesBuilder().setTerminationPointType(
+ new IpBuilder().setIpAddress(Lists.newArrayList(addr)).build()).build()).build());
final NodeKey nk = new NodeKey(new NodeId(url));
final NodeBuilder nb = new NodeBuilder();
nb.setSupportingNode(Lists.newArrayList(createSupportingNode(InstanceIdentifier.keyOf(sni).getNodeId(), inControl)));
}
- trans.putOperationalData(InstanceIdentifier.builder(target).child(Node.class, nb.getKey()).toInstance(), nb.build());
- return InstanceIdentifier.builder(target).child(Node.class, nb.getKey()).child(TerminationPoint.class, tpb.getKey()).toInstance();
+ trans.putOperationalData(InstanceIdentifier.builder(this.target).child(Node.class, nb.getKey()).toInstance(), nb.build());
+ return InstanceIdentifier.builder(this.target).child(Node.class, nb.getKey()).child(TerminationPoint.class, tpb.getKey()).toInstance();
}
- private void create(final DataModificationTransaction trans,
- final InstanceIdentifier<ReportedLsps> i, final ReportedLsps value) {
+ private void create(final DataModificationTransaction trans, final InstanceIdentifier<ReportedLsps> i, final ReportedLsps value) {
final InstanceIdentifier<Node> ni = i.firstIdentifierOf(Node.class);
final AddressFamily af = value.getLsp().getTlvs().getLspIdentifiers().getAddressFamily();
final LinkBuilder lb = new LinkBuilder();
lb.setLinkId(id);
- lb.setSource(new SourceBuilder().
- setSourceNode(src.firstKeyOf(Node.class, NodeKey.class).getNodeId()).
- setSourceTp(src.firstKeyOf(TerminationPoint.class, TerminationPointKey.class).getTpId()).build());
- lb.setDestination(new DestinationBuilder().
- setDestNode(dst.firstKeyOf(Node.class, NodeKey.class).getNodeId()).
- setDestTp(dst.firstKeyOf(TerminationPoint.class, TerminationPointKey.class).getTpId()).build());
+ lb.setSource(new SourceBuilder().setSourceNode(src.firstKeyOf(Node.class, NodeKey.class).getNodeId()).setSourceTp(
+ src.firstKeyOf(TerminationPoint.class, TerminationPointKey.class).getTpId()).build());
+ lb.setDestination(new DestinationBuilder().setDestNode(dst.firstKeyOf(Node.class, NodeKey.class).getNodeId()).setDestTp(
+ dst.firstKeyOf(TerminationPoint.class, TerminationPointKey.class).getTpId()).build());
lb.addAugmentation(Link1.class, lab.build());
trans.putOperationalData(linkForLsp(id), lb.build());
}
- private void remove(final DataModificationTransaction trans,
- final InstanceIdentifier<ReportedLsps> i, final ReportedLsps value) {
+ private void remove(final DataModificationTransaction trans, final InstanceIdentifier<ReportedLsps> i, final ReportedLsps value) {
final InstanceIdentifier<Link> li = linkForLsp(linkIdForLsp(i, value));
- final Link l = (Link)trans.readOperationalData(li);
+ final Link l = (Link) trans.readOperationalData(li);
if (l != null) {
trans.removeOperationalData(li);
- // FIXME: clean up/garbage collect nodes/termination types
+ // FIXME: BUG-195: clean up/garbage collect nodes/termination types
}
}
@Override
public void onDataChanged(final DataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
- final DataModificationTransaction trans = dataProvider.beginTransaction();
+ final DataModificationTransaction trans = this.dataProvider.beginTransaction();
final Set<InstanceIdentifier<ReportedLsps>> lsps = new HashSet<>();
final Set<InstanceIdentifier<Node>> nodes = new HashSet<>();
}
}
- Futures.addCallback(JdkFutureAdapters.listenInPoolThread(trans.commit()),
- new FutureCallback<RpcResult<TransactionStatus>>() {
+ Futures.addCallback(JdkFutureAdapters.listenInPoolThread(trans.commit()), new FutureCallback<RpcResult<TransactionStatus>>() {
@Override
public void onSuccess(final RpcResult<TransactionStatus> result) {
// Nothing to do
});
}
- public static InstanceIdentifier<Link> linkIdentifier(final InstanceIdentifier<Topology> topology,
- final NodeId node, final SymbolicPathName name) {
- return InstanceIdentifier.builder(topology).
- child(Link.class, new LinkKey(new LinkId(node.getValue() + "/lsp/" + name))).toInstance();
+ public static InstanceIdentifier<Link> linkIdentifier(final InstanceIdentifier<Topology> topology, final NodeId node,
+ final SymbolicPathName name) {
+ return InstanceIdentifier.builder(topology).child(Link.class, new LinkKey(new LinkId(node.getValue() + "/lsp/" + name))).toInstance();
}
}
TpReader(final DataModificationTransaction t, final InstanceIdentifier<Topology> topo, final TpReference ref) {
this.t = Preconditions.checkNotNull(t);
- nii = InstanceIdentifier.builder(topo).child(Node.class, new NodeKey(ref.getNode())).toInstance();
- tii = InstanceIdentifier.builder(nii).child(TerminationPoint.class, new TerminationPointKey(ref.getTp())).toInstance();
+ this.nii = InstanceIdentifier.builder(topo).child(Node.class, new NodeKey(ref.getNode())).toInstance();
+ this.tii = InstanceIdentifier.builder(this.nii).child(TerminationPoint.class, new TerminationPointKey(ref.getTp())).toInstance();
}
private Node getNode() {
- return (Node) t.readOperationalData(nii);
+ return (Node) this.t.readOperationalData(this.nii);
}
private TerminationPoint getTp() {
- return (TerminationPoint) t.readOperationalData(tii);
+ return (TerminationPoint) this.t.readOperationalData(this.tii);
}
}
if (sc.getIpv4Address() != null) {
for (final IpAddress dc : dsts) {
if (dc.getIpv4Address() != null) {
- return new Ipv4Builder().
- setSourceIpv4Address(sc.getIpv4Address()).
- setDestinationIpv4Address(dc.getIpv4Address()).build();
+ return new Ipv4Builder().setSourceIpv4Address(sc.getIpv4Address()).setDestinationIpv4Address(dc.getIpv4Address()).build();
}
}
}
if (sc.getIpv6Address() != null) {
for (final IpAddress dc : dsts) {
if (dc.getIpv6Address() != null) {
- return new Ipv6Builder().
- setSourceIpv6Address(sc.getIpv6Address()).
- setDestinationIpv6Address(dc.getIpv6Address()).build();
+ return new Ipv6Builder().setSourceIpv6Address(sc.getIpv6Address()).setDestinationIpv6Address(dc.getIpv6Address()).build();
}
}
}
}
private NodeId supportingNode(final DataModificationTransaction t, final Node node) {
- for (SupportingNode n : node.getSupportingNode()) {
+ for (final SupportingNode n : node.getSupportingNode()) {
final SupportingNode1 n1 = n.getAugmentation(SupportingNode1.class);
if (n1 != null && n1.getPathComputationClient().isControlling()) {
return n.getKey().getNodeRef();
if (!explicitHops.isEmpty()) {
final List<Subobjects> subobjs = new ArrayList<>(explicitHops.size());
- for (ExplicitHops h : explicitHops) {
+ for (final ExplicitHops h : explicitHops) {
final ExplicitHops1 h1 = h.getAugmentation(ExplicitHops1.class);
if (h1 != null) {
protected ListenableFuture<OperationResult> executeImpl() {
final InstanceIdentifier<Topology> tii = topologyIdentifier(input);
- final DataModificationTransaction t = dataProvider.beginTransaction();
-
+ final DataModificationTransaction t = TunnelProgramming.this.dataProvider.beginTransaction();
final TpReader dr = new TpReader(t, tii, input.getDestination());
final TpReader sr = new TpReader(t, tii, input.getSource());
ab.setArguments(args.build());
return Futures.transform(
- (ListenableFuture<RpcResult<AddLspOutput>>) topologyService.addLsp(ab.build()),
+ (ListenableFuture<RpcResult<AddLspOutput>>) TunnelProgramming.this.topologyService.addLsp(ab.build()),
new Function<RpcResult<AddLspOutput>, OperationResult>() {
@Override
public OperationResult apply(final RpcResult<AddLspOutput> input) {
// FIXME: tunnel programming utility class
private InstanceIdentifier<Link> linkIdentifier(final InstanceIdentifier<Topology> topology, final BaseTunnelInput input) {
- return InstanceIdentifier.builder(topology).
- child(Link.class, new LinkKey(Preconditions.checkNotNull(input.getLinkId()))).toInstance();
+ return InstanceIdentifier.builder(topology).child(Link.class, new LinkKey(Preconditions.checkNotNull(input.getLinkId()))).toInstance();
}
private Node sourceNode(final DataModificationTransaction t, final InstanceIdentifier<Topology> topology, final Link link) {
- final InstanceIdentifier<Node> nii = InstanceIdentifier.builder(topology).
- child(Node.class, new NodeKey(link.getSource().getSourceNode())).toInstance();
+ final InstanceIdentifier<Node> nii = InstanceIdentifier.builder(topology).child(Node.class,
+ new NodeKey(link.getSource().getSourceNode())).toInstance();
return (Node) t.readOperationalData(nii);
}
final InstanceIdentifier<Topology> tii = topologyIdentifier(input);
final InstanceIdentifier<Link> lii = linkIdentifier(tii, input);
- final DataModificationTransaction t = dataProvider.beginTransaction();
+ final DataModificationTransaction t = TunnelProgramming.this.dataProvider.beginTransaction();
// The link has to exist
final Link link = (Link) t.readOperationalData(lii);
ab.setNode(node.getSupportingNode().get(0).getKey().getNodeRef());
return Futures.transform(
- (ListenableFuture<RpcResult<RemoveLspOutput>>) topologyService.removeLsp(ab.build()),
+ (ListenableFuture<RpcResult<RemoveLspOutput>>) TunnelProgramming.this.topologyService.removeLsp(ab.build()),
new Function<RpcResult<RemoveLspOutput>, OperationResult>() {
@Override
public OperationResult apply(final RpcResult<RemoveLspOutput> input) {
final InstanceIdentifier<Topology> tii = topologyIdentifier(input);
final InstanceIdentifier<Link> lii = linkIdentifier(tii, input);
- final DataModificationTransaction t = dataProvider.beginTransaction();
+ final DataModificationTransaction t = TunnelProgramming.this.dataProvider.beginTransaction();
// The link has to exist
final Link link = (Link) t.readOperationalData(lii);
ab.setName(link.getAugmentation(Link1.class).getSymbolicPathName());
ab.setNode(Preconditions.checkNotNull(supportingNode(t, node)));
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.update.lsp.args.ArgumentsBuilder args =
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.update.lsp.args.ArgumentsBuilder();
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.update.lsp.args.ArgumentsBuilder args = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.update.lsp.args.ArgumentsBuilder();
args.setAdministrative(input.getAdministrativeStatus() == AdministrativeStatus.Active);
args.setBandwidth(new BandwidthBuilder().setBandwidth(input.getBandwidth()).build());
ab.setArguments(args.build());
return Futures.transform(
- (ListenableFuture<RpcResult<UpdateLspOutput>>) topologyService.updateLsp(ab.build()),
+ (ListenableFuture<RpcResult<UpdateLspOutput>>) TunnelProgramming.this.topologyService.updateLsp(ab.build()),
new Function<RpcResult<UpdateLspOutput>, OperationResult>() {
@Override
public OperationResult apply(final RpcResult<UpdateLspOutput> input) {
/**
*
*/
-public final class InstructionSchedulerImplModule extends org.opendaylight.controller.config.yang.programming.impl.AbstractInstructionSchedulerImplModule
-{
+public final class InstructionSchedulerImplModule extends
+ org.opendaylight.controller.config.yang.programming.impl.AbstractInstructionSchedulerImplModule {
- public InstructionSchedulerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ public InstructionSchedulerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+ final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
}
- public InstructionSchedulerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final InstructionSchedulerImplModule oldModule, final java.lang.AutoCloseable oldInstance) {
+ public InstructionSchedulerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+ final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+ final InstructionSchedulerImplModule 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.
}
@Override
public java.lang.AutoCloseable createInstance() {
- // FIXME: configured timer
+ // FIXME: BUG-192 : configured timer
final Timer timer = new HashedWheelTimer();
final ExecutorService exec = Executors.newSingleThreadExecutor();
private java.util.concurrent.Future<Void> thread;
private ExecutorService exec;
- public ProgrammingServiceImpl(final NotificationProviderService notifs, final ExecutorService executor,
- final Timer timer) {
+ public ProgrammingServiceImpl(final NotificationProviderService notifs, final ExecutorService executor, final Timer timer) {
this.notifs = Preconditions.checkNotNull(notifs);
this.executor = Preconditions.checkNotNull(executor);
this.timer = Preconditions.checkNotNull(timer);
@Override
public java.util.concurrent.Future<RpcResult<CancelInstructionOutput>> cancelInstruction(final CancelInstructionInput input) {
- return executor.submit(new Callable<RpcResult<CancelInstructionOutput>>() {
+ return this.executor.submit(new Callable<RpcResult<CancelInstructionOutput>>() {
@Override
public RpcResult<CancelInstructionOutput> call() {
return realCancelInstruction(input);
});
}
- private synchronized RpcResult<CancelInstructionOutput> realCancelInstruction(final CancelInstructionInput input) {
- final Instruction i = insns.get(input.getId());
+ private synchronized RpcResult<CancelInstructionOutput> realCancelInstruction(final CancelInstructionInput input) {
+ final Instruction i = this.insns.get(input.getId());
if (i == null) {
LOG.debug("Instruction {} not present in the graph", input.getId());
case Successful:
case Unknown:
LOG.debug("Instruction {} can no longer be cancelled due to status {}", input.getId());
- return SuccessfulRpcResult.create(
- new CancelInstructionOutputBuilder().setFailure(UncancellableInstruction.class).build());
+ return SuccessfulRpcResult.create(new CancelInstructionOutputBuilder().setFailure(UncancellableInstruction.class).build());
case Queued:
case Scheduled:
break;
@Override
public Failure submitInstruction(final SubmitInstructionInput input, final InstructionExecutor executor) {
final InstructionId id = input.getId();
- if (insns.get(id) != null) {
+ if (this.insns.get(id) != null) {
LOG.info("Instruction ID {} already present", id);
return new FailureBuilder().setType(DuplicateInstructionId.class).build();
}
// Resolve dependencies
final List<Instruction> dependencies = new ArrayList<>();
for (final InstructionId pid : input.getPreconditions()) {
- final Instruction i = insns.get(pid);
+ final Instruction i = this.insns.get(pid);
if (i == null) {
LOG.info("Instruction {} depends on {}, which is not a known instruction", id, pid);
return new FailureBuilder().setType(UnknownPreconditionId.class).build();
*/
// Schedule a timeout for the instruction
- final Timeout t = timer.newTimeout(new TimerTask() {
+ final Timeout t = this.timer.newTimeout(new TimerTask() {
@Override
public void run(final Timeout timeout) throws Exception {
timeoutInstruction(input.getId());
// Put it into the instruction list
final Instruction i = new Instruction(input.getId(), executor, dependencies, t);
- insns.put(id, i);
+ this.insns.put(id, i);
// Attach it into its dependencies
for (final Instruction d : dependencies) {
LOG.debug("Instruction {} transitioned to status {}", v.getId(), status);
// Send out a notification
- notifs.publish(new InstructionStatusChangedBuilder().
- setId(v.getId()).setStatus(status).setDetails(details).build());
+ this.notifs.publish(new InstructionStatusChangedBuilder().setId(v.getId()).setStatus(status).setDetails(details).build());
}
@GuardedBy("this")
}
private synchronized void cancelInstruction(final Instruction i, final Details details) {
- readyQueue.remove(i);
+ this.readyQueue.remove(i);
cancelSingle(i, details);
cancelDependants(i);
}
private synchronized void timeoutInstruction(final InstructionId id) {
- final Instruction i = insns.get(id);
+ final Instruction i = this.insns.get(id);
if (i == null) {
LOG.warn("Instruction {} timed out, but not found in the queue", id);
return;
break;
case Scheduled:
LOG.debug("Instruction {} timed out while Scheduled, cancelling it", i.getId());
- // FIXME: we should provide details why it timed out while scheduled
+ // FIXME: BUG-191: we should provide details why it timed out while scheduled
cancelInstruction(i, null);
break;
}
LOG.debug("Instruction {} is ready for execution", i.getId());
transitionInstruction(i, InstructionStatus.Scheduled, null);
- readyQueue.add(i);
+ this.readyQueue.add(i);
notify();
}
}
* This method is only ever interrupted by InterruptedException
*/
while (true) {
- while (!readyQueue.isEmpty()) {
- final Instruction i = readyQueue.poll();
+ while (!this.readyQueue.isEmpty()) {
+ final Instruction i = this.readyQueue.poll();
Preconditions.checkState(i.getStatus().equals(InstructionStatus.Scheduled));
}
synchronized void start(final ThreadFactory threadFactory) {
- Preconditions.checkState(exec == null, "Programming service dispatch thread already started");
+ Preconditions.checkState(this.exec == null, "Programming service dispatch thread already started");
- exec = Executors.newSingleThreadExecutor(threadFactory);
- thread = exec.submit(new Callable<Void>() {
+ this.exec = Executors.newSingleThreadExecutor(threadFactory);
+ this.thread = this.exec.submit(new Callable<Void>() {
@Override
public Void call() {
try {
processQueues();
- } catch (InterruptedException ex) {
+ } catch (final InterruptedException ex) {
LOG.error("Programming service dispatch thread died", ex);
}
return null;
}
});
- exec.shutdown();
+ this.exec.shutdown();
}
synchronized void stop(final long timeout, final TimeUnit unit) throws InterruptedException {
- Preconditions.checkState(exec != null, "Programming service dispatch thread already stopped");
+ Preconditions.checkState(this.exec != null, "Programming service dispatch thread already stopped");
- thread.cancel(true);
- exec.awaitTermination(timeout, unit);
- exec = null;
+ this.thread.cancel(true);
+ this.exec.awaitTermination(timeout, unit);
+ this.exec = null;
}
@Override