Removed unused binary files.
Change-Id: I1bdf8f3bd7d66ab0ae57114c2f9beb79626b7b1a
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
description "SRP Object";
reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-05#section-7.2";
- uses object;
-
- leaf operation-id {
- type srp-id-number;
- mandatory true;
- }
-
- leaf flags {
- type bits {
- bit lsp-remove {
- position 31;
+ container srp {
+ uses object;
+
+ leaf operation-id {
+ type srp-id-number;
+ mandatory true;
+ }
+
+ leaf flags {
+ type bits {
+ bit lsp-remove {
+ position 31;
+ }
}
}
}
}
case stateful {
- container srp {
- reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-05#section-6.3";
- uses srp-object;
- }
+ reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-05#section-6.3";
+ uses srp-object;
}
}
}
uses message-header;
list updates {
- container srp {
- uses srp-object;
- }
+ uses srp-object;
container lsp {
uses lsp-object;
uses message-header;
list reports {
- container srp {
- uses srp-object;
- }
+ uses srp-object;
container lsp {
uses lsp-object;
uses message-header;
list requests {
- container srp {
- uses srp-object;
- }
+ uses srp-object;
container lsp {
uses lsp-object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PcrptMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PcupdMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ReportedRouteObject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.SrpObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.SvecObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.close.object.CClose;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.subobjects.subobject.type.PathKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissing;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.Rp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rsvp.error.spec.tlv.RsvpErrorSpec;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.srp.object.Srp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.stateful.capability.tlv.Stateful;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.symbolic.path.name.tlv.SymbolicPathName;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.basic.explicit.route.subobjects.subobject.type.AsNumber;
context.registerObjectSerializer(ClasstypeObject.class, new PCEPClassTypeObjectParser(tlvReg));
context.registerObjectSerializer(GcObject.class, new PCEPGlobalConstraintsObjectParser(tlvReg));
context.registerObjectSerializer(LspObject.class, new PCEPLspObjectParser(tlvReg));
- context.registerObjectSerializer(SrpObject.class, new PCEPSrpObjectParser(tlvReg));
+ context.registerObjectSerializer(Srp.class, new PCEPSrpObjectParser(tlvReg));
context.registerObjectSerializer(ExcludeRouteObject.class, new PCEPExcludeRouteObjectParser(xroSubReg));
context.registerMessageParser(PCEPOpenMessageParser.TYPE, new PCEPOpenMessageParser(objReg));
import io.netty.buffer.ByteBuf;
+import java.util.List;
+
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDocumentedException;
+import org.opendaylight.protocol.pcep.PCEPErrors;
+import org.opendaylight.protocol.pcep.UnknownObject;
import org.opendaylight.protocol.pcep.impl.AbstractMessageParser;
import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.BandwidthObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.EndpointsObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ExplicitRouteObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.LspaObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.MetricObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PcinitiateMessage;
+import com.google.common.collect.Lists;
+
/**
* Parser for {@link PCCreateMessage}
*/
throw new IllegalArgumentException("Wrong instance of Message. Passed instance of " + message.getClass()
+ ". Needed PcinitiateMessage.");
}
+ // final PcinitiateMessage init =
}
@Override
- public PcinitiateMessage parseMessage(final byte[] buffer) throws PCEPDeserializerException {
+ public Message parseMessage(final byte[] buffer) throws PCEPDeserializerException, PCEPDocumentedException {
+ if (buffer == null || buffer.length == 0) {
+ throw new PCEPDeserializerException("Initiate message cannot be empty.");
+ }
+ final List<Object> objs = parseObjects(buffer);
+ return validate(objs);
+ }
+
+ public Message validate(final List<Object> objects) throws PCEPDeserializerException {
+ if (objects == null) {
+ throw new IllegalArgumentException("Passed list can't be null.");
+ }
return null;
+ // final List<CompositeInstantiationObject> insts = new ArrayList<CompositeInstantiationObject>();
+ //
+ // CompositeInstantiationObject inst;
+ // while (!objects.isEmpty()) {
+ // try {
+ // if ((inst = this.getValidInstantiationObject(objects)) == null) {
+ // break;
+ // }
+ // } catch (final PCEPDocumentedException e) {
+ // return Arrays.asList((Message) new PCEPErrorMessage(new PCEPErrorObject(e.getError())));
+ // }
+ //
+ // insts.add(inst);
+ // }
+ //
+ // if (insts.isEmpty()) {
+ // throw new PCEPDeserializerException("At least one CompositeInstantiationObject is mandatory.");
+ // }
+ //
+ // if (!objects.isEmpty()) {
+ // throw new PCEPDeserializerException("Unprocessed objects: " + objects);
+ // }
+ //
+ // return Arrays.asList((Message) new PCCreateMessage(insts));
+ }
+
+ private void getValidInstantiationObject(final List<Object> objects) throws PCEPDocumentedException {
+ if (objects.get(0) instanceof UnknownObject) {
+ throw new PCEPDocumentedException("Unknown object", ((UnknownObject) objects.get(0)).getError());
+ }
+ if (!(objects.get(0) instanceof EndpointsObject)) {
+ return;
+ }
+
+ final EndpointsObject endPoints = ((EndpointsObject) objects.get(0));
+ objects.remove(0);
+
+ if (objects.get(0) instanceof UnknownObject) {
+ throw new PCEPDocumentedException("Unknown object", ((UnknownObject) objects.get(0)).getError());
+ }
+ if (!(objects.get(0) instanceof LspaObject)) {
+ throw new PCEPDocumentedException("LSPA Object must be second.", PCEPErrors.LSPA_MISSING);
+ }
+ final LspaObject lspa = (LspaObject) objects.get(0);
+ objects.remove(0);
+
+ ExplicitRouteObject ero = null;
+ BandwidthObject bandwidth = null;
+ final List<MetricObject> metrics = Lists.newArrayList();
+
+ Object obj;
+ int state = 1;
+ while (!objects.isEmpty()) {
+ obj = objects.get(0);
+ if (obj instanceof UnknownObject) {
+ throw new PCEPDocumentedException("Unknown object", ((UnknownObject) obj).getError());
+ }
+
+ switch (state) {
+ case 1:
+ state = 2;
+ if (obj instanceof ExplicitRouteObject) {
+ ero = (ExplicitRouteObject) obj;
+ break;
+ }
+ case 2:
+ state = 3;
+ if (obj instanceof BandwidthObject) {
+ bandwidth = (BandwidthObject) obj;
+ break;
+ }
+ case 3:
+ state = 4;
+ if (obj instanceof MetricObject) {
+ metrics.add((MetricObject) obj);
+ state = 3;
+ break;
+ }
+ }
+
+ if (state == 4) {
+ break;
+ }
+
+ objects.remove(0);
+ }
+
+ // return new CompositeInstantiationObject(endPoints, lspa, ero, bandwidth, metrics);
}
@Override
import io.netty.buffer.ByteBuf;
+import java.util.List;
+
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.impl.AbstractMessageParser;
import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
return null;
}
+ public List<Message> validate(final List<Object> objects) throws PCEPDeserializerException {
+ if (objects == null) {
+ throw new IllegalArgumentException("Passed list can't be null.");
+ }
+
+ // final List<CompositeUpdateRequestObject> updateRequests = new ArrayList<CompositeUpdateRequestObject>();
+ //
+ // while (!objects.isEmpty()) {
+ // if (objects.get(0) instanceof UnknownObject) {
+ // logger.warn("Unknown object found (should be Lsp) - {}.", objects.get(0));
+ // return Arrays.asList((Message) new PCEPErrorMessage(new PCEPErrorObject(((UnknownObject)
+ // objects.get(0)).getError())));
+ // }
+ // if (!(objects.get(0) instanceof PCEPLspObject)) {
+ // return Arrays.asList((Message) new PCEPErrorMessage(new PCEPErrorObject(PCEPErrors.LSP_MISSING)));
+ // }
+ //
+ // final PCEPLspObject lsp = (PCEPLspObject) objects.get(0);
+ // objects.remove(0);
+ //
+ // final List<CompositeUpdPathObject> paths = new ArrayList<CompositeUpdPathObject>();
+ //
+ // if (!objects.isEmpty()) {
+ // try {
+ // CompositeUpdPathObject path;
+ // path = this.getValidCompositePath(objects);
+ // while (path != null) {
+ // paths.add(path);
+ // if (objects.isEmpty()) {
+ // break;
+ // }
+ // path = this.getValidCompositePath(objects);
+ // }
+ // } catch (final PCEPDocumentedException e) {
+ // logger.warn("Serializing failed: {}.", e);
+ // return Arrays.asList((Message) new PCEPErrorMessage(new PCEPErrorObject(e.getError())));
+ // }
+ // }
+ //
+ // updateRequests.add(new CompositeUpdateRequestObject(lsp, paths));
+ // }
+ //
+ // if (updateRequests.isEmpty()) {
+ // return Arrays.asList((Message) new PCEPErrorMessage(new PCEPErrorObject(PCEPErrors.LSP_MISSING)));
+ // }
+ //
+ // if (!objects.isEmpty()) {
+ // throw new PCEPDeserializerException("Unprocessed Objects: " + objects);
+ // }
+ //
+ // return Arrays.asList((Message) new PCEPUpdateRequestMessage(updateRequests));
+ return null;
+ }
+
+ // private CompositeUpdPathObject getValidCompositePath(final List<Object> objects) throws PCEPDocumentedException {
+ // if (!(objects.get(0) instanceof PCEPExplicitRouteObject)) {
+ // return null;
+ // }
+ //
+ // if (objects.get(0) instanceof UnknownObject) {
+ // }
+ // final PCEPExplicitRouteObject explicitRoute = (PCEPExplicitRouteObject) objects.get(0);
+ // objects.remove(0);
+ //
+ // PCEPLspaObject pathLspa = null;
+ // PCEPRequestedPathBandwidthObject pathBandwidth = null;
+ // final List<PCEPMetricObject> pathMetrics = new ArrayList<PCEPMetricObject>();
+ //
+ // Object obj;
+ // int state = 1;
+ // while (!objects.isEmpty()) {
+ // obj = objects.get(0);
+ // if (obj instanceof UnknownObject) {
+ // throw new PCEPDocumentedException("Unknown object", ((UnknownObject) obj).getError());
+ // }
+ //
+ // switch (state) {
+ // case 1:
+ // state = 2;
+ // if (obj instanceof PCEPLspaObject) {
+ // pathLspa = (PCEPLspaObject) obj;
+ // break;
+ // }
+ // case 2:
+ // state = 3;
+ // if (obj instanceof PCEPRequestedPathBandwidthObject) {
+ // pathBandwidth = (PCEPRequestedPathBandwidthObject) obj;
+ // break;
+ // }
+ // case 3:
+ // state = 4;
+ // if (obj instanceof PCEPMetricObject) {
+ // pathMetrics.add((PCEPMetricObject) obj);
+ // state = 3;
+ // break;
+ // }
+ // }
+ //
+ // if (state == 4) {
+ // break;
+ // }
+ //
+ // objects.remove(0);
+ // }
+ //
+ // return new CompositeUpdPathObject(explicitRoute, pathLspa, pathBandwidth, pathMetrics);
+ // }
+
@Override
public int getMessageType() {
return TYPE;
+++ /dev/null
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.pcep.impl.message;
-
-import java.util.List;
-
-import org.opendaylight.protocol.pcep.PCEPDeserializerException;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * PCEPUpdateRequestMessage validator. Validates message integrity.
- */
-// FIXME: merge with parser
-class PCEPUpdateRequestMessageValidator {
-
- private static final Logger logger = LoggerFactory.getLogger(PCEPUpdateRequestMessageValidator.class);
-
- public List<Message> validate(final List<Object> objects) throws PCEPDeserializerException {
- if (objects == null)
- throw new IllegalArgumentException("Passed list can't be null.");
-
- // final List<CompositeUpdateRequestObject> updateRequests = new ArrayList<CompositeUpdateRequestObject>();
- //
- // while (!objects.isEmpty()) {
- // if (objects.get(0) instanceof UnknownObject) {
- // logger.warn("Unknown object found (should be Lsp) - {}.", objects.get(0));
- // return Arrays.asList((Message) new PCEPErrorMessage(new PCEPErrorObject(((UnknownObject)
- // objects.get(0)).getError())));
- // }
- // if (!(objects.get(0) instanceof PCEPLspObject))
- // return Arrays.asList((Message) new PCEPErrorMessage(new PCEPErrorObject(PCEPErrors.LSP_MISSING)));
- //
- // final PCEPLspObject lsp = (PCEPLspObject) objects.get(0);
- // objects.remove(0);
- //
- // final List<CompositeUpdPathObject> paths = new ArrayList<CompositeUpdPathObject>();
- //
- // if (!objects.isEmpty()) {
- // try {
- // CompositeUpdPathObject path;
- // path = this.getValidCompositePath(objects);
- // while (path != null) {
- // paths.add(path);
- // if (objects.isEmpty())
- // break;
- // path = this.getValidCompositePath(objects);
- // }
- // } catch (final PCEPDocumentedException e) {
- // logger.warn("Serializing failed: {}.", e);
- // return Arrays.asList((Message) new PCEPErrorMessage(new PCEPErrorObject(e.getError())));
- // }
- // }
- //
- // updateRequests.add(new CompositeUpdateRequestObject(lsp, paths));
- // }
- //
- // if (updateRequests.isEmpty())
- // return Arrays.asList((Message) new PCEPErrorMessage(new PCEPErrorObject(PCEPErrors.LSP_MISSING)));
- //
- // if (!objects.isEmpty())
- // throw new PCEPDeserializerException("Unprocessed Objects: " + objects);
- //
- // return Arrays.asList((Message) new PCEPUpdateRequestMessage(updateRequests));
- return null;
- }
-
- // private CompositeUpdPathObject getValidCompositePath(final List<Object> objects) throws PCEPDocumentedException {
- // if (!(objects.get(0) instanceof PCEPExplicitRouteObject))
- // return null;
- //
- // if (objects.get(0) instanceof UnknownObject)
- // throw new PCEPDocumentedException("Unknown object", ((UnknownObject) objects.get(0)).getError());
- // final PCEPExplicitRouteObject explicitRoute = (PCEPExplicitRouteObject) objects.get(0);
- // objects.remove(0);
- //
- // PCEPLspaObject pathLspa = null;
- // PCEPRequestedPathBandwidthObject pathBandwidth = null;
- // final List<PCEPMetricObject> pathMetrics = new ArrayList<PCEPMetricObject>();
- //
- // Object obj;
- // int state = 1;
- // while (!objects.isEmpty()) {
- // obj = objects.get(0);
- // if (obj instanceof UnknownObject) {
- // throw new PCEPDocumentedException("Unknown object", ((UnknownObject) obj).getError());
- // }
- //
- // switch (state) {
- // case 1:
- // state = 2;
- // if (obj instanceof PCEPLspaObject) {
- // pathLspa = (PCEPLspaObject) obj;
- // break;
- // }
- // case 2:
- // state = 3;
- // if (obj instanceof PCEPRequestedPathBandwidthObject) {
- // pathBandwidth = (PCEPRequestedPathBandwidthObject) obj;
- // break;
- // }
- // case 3:
- // state = 4;
- // if (obj instanceof PCEPMetricObject) {
- // pathMetrics.add((PCEPMetricObject) obj);
- // state = 3;
- // break;
- // }
- // }
- //
- // if (state == 4)
- // break;
- //
- // objects.remove(0);
- // }
- //
- // return new CompositeUpdPathObject(explicitRoute, pathLspa, pathBandwidth, pathMetrics);
- // }
-
-}
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.SrpIdNumber;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.SrpObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.pcinitiate.message.requests.SrpBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.srp.object.Srp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.srp.object.SrpBuilder;
/**
- * Parser for {@link SrpObject}
+ * Parser for {@link Srp}
*/
public final class PCEPSrpObjectParser extends AbstractObjectWithTlvsParser<SrpBuilder> {
}
@Override
- public SrpObject parseObject(final ObjectHeader header, final byte[] bytes) throws PCEPDeserializerException, PCEPDocumentedException {
+ public Srp parseObject(final ObjectHeader header, final byte[] bytes) throws PCEPDeserializerException, PCEPDocumentedException {
if (bytes == null || bytes.length == 0) {
throw new IllegalArgumentException("Array of bytes is mandatory. Can't be null or empty.");
}
@Override
public byte[] serializeObject(final Object object) {
- if (!(object instanceof SrpObject)) {
+ if (!(object instanceof Srp)) {
throw new IllegalArgumentException("Wrong instance of PCEPObject. Passed " + object.getClass() + ". Needed SrpObject.");
}
- final SrpObject srp = (SrpObject) object;
+ final Srp srp = (Srp) object;
final Long id = srp.getOperationId().getValue();
if (id == 0 || id == 0xFFFFFFFFL) {
throw new IllegalArgumentException("Min/Max values for SRP ID are reserved.");
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.error.object.TlvsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.pcinitiate.message.requests.EndpointsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.pcinitiate.message.requests.LspBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.pcinitiate.message.requests.SrpBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.result.failure.NoPathBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.result.failure.no.path.tlvs.NoPathVectorBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.SvecBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.predundancy.group.id.tlv.PredundancyGroupIdBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissingBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.RpBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.srp.object.SrpBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.stateful.capability.tlv.Stateful;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.stateful.capability.tlv.Stateful.Flags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.stateful.capability.tlv.StatefulBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PlspId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ProtocolVersion;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.SrpIdNumber;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.SrpObject.Flags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.object.TlvsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.Tlvs;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.PcerrMessageBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.PcinitiateMessageBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.pcinitiate.message.RequestsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.pcinitiate.message.requests.LspBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.pcinitiate.message.requests.SrpBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrpt.message.pcrpt.message.Reports;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrpt.message.pcrpt.message.reports.Lsp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrpt.message.pcrpt.message.reports.Srp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcupd.message.PcupdMessageBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcupd.message.pcupd.message.UpdatesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcupd.message.pcupd.message.updates.PathBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.srp.object.Srp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.srp.object.Srp.Flags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.srp.object.SrpBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.stateful.capability.tlv.Stateful;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.symbolic.path.name.tlv.SymbolicPathName;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.symbolic.path.name.tlv.SymbolicPathNameBuilder;
final Node topologyNode(final DataModificationTransaction trans, final InetAddress address) {
final String pccId = createNodeId(address);
- final Topology topo = (Topology)trans.readOperationalData(topology);
+ final Topology topo = (Topology) trans.readOperationalData(ServerSessionManager.this.topology);
for (final Node n : topo.getNode()) {
LOG.debug("Matching topology node {} to id {}", n, pccId);
this.pccBuilder.setStateSync(PccSyncState.InitialResync);
}
- topologyAugmentBuilder = new Node1Builder().setPathComputationClient(pccBuilder.build());
- topologyAugment = InstanceIdentifier.builder(topologyNode).node(Node1.class).toInstance();
- trans.putRuntimeData(topologyAugment, topologyAugmentBuilder.build());
+ this.topologyAugmentBuilder = new Node1Builder().setPathComputationClient(this.pccBuilder.build());
+ this.topologyAugment = InstanceIdentifier.builder(this.topologyNode).node(Node1.class).toInstance();
+ trans.putRuntimeData(this.topologyAugment, this.topologyAugmentBuilder.build());
// All set, commit the modifications
final Future<RpcResult<TransactionStatus>> s = trans.commit();
return;
}
- nodes.put(nodeId, this);
+ ServerSessionManager.this.nodes.put(this.nodeId, this);
this.session = session;
LOG.info("Session with {} attached to topology node {}", session.getRemoteAddress(), topoNode.getNodeId());
}
@GuardedBy("this")
private void tearDown(final PCEPSession session) {
this.session = null;
- nodes.remove(nodeId);
+ ServerSessionManager.this.nodes.remove(this.nodeId);
final DataModificationTransaction trans = ServerSessionManager.this.dataProvider.beginTransaction();
// The session went down. Undo all the Topology changes we have done.
- trans.removeRuntimeData(topologyAugment);
- if (ownsTopology) {
- trans.removeRuntimeData(topologyNode);
+ trans.removeRuntimeData(this.topologyAugment);
+ if (this.ownsTopology) {
+ trans.removeRuntimeData(this.topologyNode);
}
/*
}
// Clear all requests which have not been sent to the peer: they result in cancellation
- for (Entry<SrpIdNumber, Promise<ExecutionResult<Details>>> e : sendingRequests.entrySet()) {
+ for (final Entry<SrpIdNumber, Promise<ExecutionResult<Details>>> e : this.sendingRequests.entrySet()) {
LOG.debug("Request {} was not sent when session went down, cancelling the instruction", e.getKey());
e.getValue().setSuccess(new ExecutionResult<Details>(InstructionStatus.Cancelled, null));
}
- sendingRequests.clear();
+ this.sendingRequests.clear();
// CLear all requests which have not been acked by the peer: they result in failure
- for (Entry<SrpIdNumber, Promise<ExecutionResult<Details>>> e : waitingRequests.entrySet()) {
+ for (final Entry<SrpIdNumber, Promise<ExecutionResult<Details>>> e : this.waitingRequests.entrySet()) {
LOG.info("Request {} was incomplete when session went down, failing the instruction", e.getKey());
e.getValue().setSuccess(new ExecutionResult<Details>(InstructionStatus.Failed, null));
}
- waitingRequests.clear();
+ this.waitingRequests.clear();
}
@Override
}
private InstanceIdentifier<ReportedLsps> lspIdentifier(final SymbolicPathName name) {
- return InstanceIdentifier.builder(topologyAugment).
- node(ReportedLsps.class, new ReportedLspsKey(name.getPathName())).toInstance();
+ return InstanceIdentifier.builder(this.topologyAugment).node(ReportedLsps.class, new ReportedLspsKey(name.getPathName())).toInstance();
}
@Override
if (lsp.isSync() && !this.synced) {
// Update synchronization flag
- synced = true;
- topologyAugmentBuilder.setPathComputationClient(pccBuilder.setStateSync(PccSyncState.Synchronized).build());
- trans.putRuntimeData(topologyAugment, topologyAugmentBuilder.build());
+ this.synced = true;
+ this.topologyAugmentBuilder.setPathComputationClient(this.pccBuilder.setStateSync(PccSyncState.Synchronized).build());
+ trans.putRuntimeData(this.topologyAugment, this.topologyAugmentBuilder.build());
LOG.debug("Session {} achieved synchronized state", session);
}
case Active:
case Down:
case Up:
- final Promise<ExecutionResult<Details>> p = waitingRequests.remove(id);
+ final Promise<ExecutionResult<Details>> p = this.waitingRequests.remove(id);
if (p != null) {
LOG.debug("Request {} resulted in LSP operational state {}", id, lsp.getOperational());
p.setSuccess(new ExecutionResult<Details>(InstructionStatus.Successful, null));
}
private synchronized SrpIdNumber nextRequest() {
- return new SrpIdNumber(requestId++);
+ return new SrpIdNumber(this.requestId++);
}
private synchronized void messageSendingComplete(final SrpIdNumber requestId, final io.netty.util.concurrent.Future<Void> future) {
- final Promise<ExecutionResult<Details>> promise = sendingRequests.remove(requestId);
+ final Promise<ExecutionResult<Details>> promise = this.sendingRequests.remove(requestId);
if (future.isSuccess()) {
- waitingRequests.put(requestId, promise);
+ this.waitingRequests.put(requestId, promise);
} else {
LOG.info("Failed to send request {}, instruction cancelled", requestId, future.cause());
promise.setSuccess(new ExecutionResult<Details>(InstructionStatus.Cancelled, null));
}
}
- private synchronized io.netty.util.concurrent.Future<ExecutionResult<Details>> sendMessage(final Message message, final SrpIdNumber requestId) {
- final io.netty.util.concurrent.Future<Void> f = session.sendMessage(message);
+ private synchronized io.netty.util.concurrent.Future<ExecutionResult<Details>> sendMessage(final Message message,
+ final SrpIdNumber requestId) {
+ final io.netty.util.concurrent.Future<Void> f = this.session.sendMessage(message);
final Promise<ExecutionResult<Details>> ret = exec.newPromise();
- sendingRequests.put(requestId, ret);
+ this.sendingRequests.put(requestId, ret);
f.addListener(new FutureListener<Void>() {
@Override
private static final Pcerr unhandledMessageError = new PcerrBuilder().setPcerrMessage(
new PcerrMessageBuilder().setErrorType(null).build()).build();
private static final MessageHeader messageHeader = new MessageHeader() {
- private final ProtocolVersion version = new ProtocolVersion((short)1);
+ private final ProtocolVersion version = new ProtocolVersion((short) 1);
@Override
public Class<? extends DataContainer> getImplementedInterface() {
@Override
public ProtocolVersion getVersion() {
- return version;
+ return this.version;
}
};
private static final EventExecutor exec = GlobalEventExecutor.INSTANCE;
private synchronized io.netty.util.concurrent.Future<ExecutionResult<Details>> realAddLsp(final AddLspInput input) {
// Get the listener corresponding to the node
- final SessionListener l = nodes.get(input.getNode());
+ final SessionListener l = this.nodes.get(input.getNode());
if (l == null) {
LOG.debug("Session for node {} not found", input.getNode());
return exec.newSucceededFuture(new ExecutionResult<Details>(InstructionStatus.Cancelled, null));
}
- final InstanceIdentifier<ReportedLsps> lsp = InstanceIdentifier.builder(l.topologyAugment).node(ReportedLsps.class, new ReportedLspsKey(input.getName())).toInstance();
- if (dataProvider.readOperationalData(lsp) != null) {
+ final InstanceIdentifier<ReportedLsps> lsp = InstanceIdentifier.builder(l.topologyAugment).node(ReportedLsps.class,
+ new ReportedLspsKey(input.getName())).toInstance();
+ if (this.dataProvider.readOperationalData(lsp) != null) {
LOG.debug("Node {} already contains lsp {} at {}", input.getNode(), input.getName(), lsp);
return exec.newSucceededFuture(new ExecutionResult<Details>(InstructionStatus.Cancelled, null));
}
final RequestsBuilder rb = new RequestsBuilder(input.getArguments());
rb.setSrp(new SrpBuilder().setOperationId(l.nextRequest()).setProcessingRule(Boolean.TRUE).build());
- rb.setLsp(
- new LspBuilder().setAdministrative(input.getArguments().isAdministrative()).setTlvs(
- new TlvsBuilder().setSymbolicPathName(
- new SymbolicPathNameBuilder().setPathName(input.getName()).build()).build()).build());
+ rb.setLsp(new LspBuilder().setAdministrative(input.getArguments().isAdministrative()).setTlvs(
+ new TlvsBuilder().setSymbolicPathName(new SymbolicPathNameBuilder().setPathName(input.getName()).build()).build()).build());
final PcinitiateMessageBuilder ib = new PcinitiateMessageBuilder(messageHeader);
ib.setRequests(ImmutableList.of(rb.build()));
private synchronized io.netty.util.concurrent.Future<ExecutionResult<Details>> realRemoveLsp(final RemoveLspInput input) {
// Get the listener corresponding to the node
- final SessionListener l = nodes.get(input.getNode());
+ final SessionListener l = this.nodes.get(input.getNode());
if (l == null) {
LOG.debug("Session for node {} not found", input.getNode());
return exec.newSucceededFuture(new ExecutionResult<Details>(InstructionStatus.Cancelled, null));
}
- final InstanceIdentifier<ReportedLsps> lsp = InstanceIdentifier.builder(l.topologyAugment).node(ReportedLsps.class, new ReportedLspsKey(input.getName())).toInstance();
- final ReportedLsps rep = (ReportedLsps) dataProvider.readOperationalData(lsp);
+ final InstanceIdentifier<ReportedLsps> lsp = InstanceIdentifier.builder(l.topologyAugment).node(ReportedLsps.class,
+ new ReportedLspsKey(input.getName())).toInstance();
+ final ReportedLsps rep = (ReportedLsps) this.dataProvider.readOperationalData(lsp);
if (rep == null) {
LOG.debug("Node {} does not contain LSP {}", input.getNode(), input.getName());
return exec.newSucceededFuture(new ExecutionResult<Details>(InstructionStatus.Cancelled, null));
private synchronized io.netty.util.concurrent.Future<ExecutionResult<Details>> realUpdateLsp(final UpdateLspInput input) {
// Get the listener corresponding to the node
- final SessionListener l = nodes.get(input.getNode());
+ final SessionListener l = this.nodes.get(input.getNode());
if (l == null) {
LOG.debug("Session for node {} not found", input.getNode());
return exec.newSucceededFuture(new ExecutionResult<Details>(InstructionStatus.Cancelled, null));
}
- final InstanceIdentifier<ReportedLsps> lsp = InstanceIdentifier.builder(l.topologyAugment).node(ReportedLsps.class, new ReportedLspsKey(input.getName())).toInstance();
- final ReportedLsps rep = (ReportedLsps) dataProvider.readOperationalData(lsp);
+ final InstanceIdentifier<ReportedLsps> lsp = InstanceIdentifier.builder(l.topologyAugment).node(ReportedLsps.class,
+ new ReportedLspsKey(input.getName())).toInstance();
+ final ReportedLsps rep = (ReportedLsps) this.dataProvider.readOperationalData(lsp);
if (rep == null) {
LOG.debug("Node {} does not contain LSP {}", input.getNode(), input.getName());
return exec.newSucceededFuture(new ExecutionResult<Details>(InstructionStatus.Cancelled, null));
}
final UpdatesBuilder rb = new UpdatesBuilder();
- rb.setSrp(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcupd.message.pcupd.message.updates.SrpBuilder().setOperationId(l.nextRequest()).setProcessingRule(Boolean.TRUE).build());
- rb.setLsp(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcupd.message.pcupd.message.updates.LspBuilder().
- setPlspId(rep.getLsp().getPlspId()).setDelegate(Boolean.TRUE).build());
+ rb.setSrp(new SrpBuilder().setOperationId(l.nextRequest()).setProcessingRule(Boolean.TRUE).build());
+ rb.setLsp(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcupd.message.pcupd.message.updates.LspBuilder().setPlspId(
+ rep.getLsp().getPlspId()).setDelegate(Boolean.TRUE).build());
rb.setPath(new PathBuilder(input.getArguments()).build());
final PcupdMessageBuilder ub = new PcupdMessageBuilder(messageHeader);