use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160621.module.list.CommonLeafs.Revision in project bgpcep by opendaylight.
the class AbstractTopologySessionListener method updateLsp.
/**
* Update an LSP in the data store.
*
* @param ctx Message context
* @param id Revision-specific LSP identifier
* @param lspName LSP name
* @param rlb Reported LSP builder
* @param solicited True if the update was solicited
* @param remove True if this is an LSP path removal
*/
protected final synchronized void updateLsp(final MessageContext ctx, final L id, final String lspName, final ReportedLspBuilder rlb, final boolean solicited, final boolean remove) {
final String name;
if (lspName == null) {
name = this.lsps.get(id);
if (name == null) {
LOG.error("PLSPID {} seen for the first time, not reporting the LSP", id);
return;
}
} else {
name = lspName;
}
LOG.debug("Saved LSP {} with name {}", id, name);
this.lsps.put(id, name);
final ReportedLsp previous = this.lspData.get(name);
// if no previous report about the lsp exist, just proceed
if (previous != null) {
final Map<PathKey, Path> updatedPaths = makeBeforeBreak(rlb, previous, name, remove);
// if all paths or the last path were deleted, delete whole tunnel
if (updatedPaths.isEmpty()) {
LOG.debug("All paths were removed, removing LSP with {}.", id);
removeLsp(ctx, id);
return;
}
rlb.setPath(updatedPaths);
}
rlb.withKey(new ReportedLspKey(name));
rlb.setName(name);
// If this is an unsolicited update. We need to make sure we retain the metadata already present
if (solicited) {
this.nodeState.setLspMetadata(name, rlb.getMetadata());
} else {
rlb.setMetadata(this.nodeState.getLspMetadata(name));
}
final ReportedLsp rl = rlb.build();
ctx.trans.put(LogicalDatastoreType.OPERATIONAL, this.pccIdentifier.child(ReportedLsp.class, rlb.key()), rl);
LOG.debug("LSP {} updated to MD-SAL", name);
this.lspData.put(name, rl);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160621.module.list.CommonLeafs.Revision in project mdsal by opendaylight.
the class MountPointContextFactoryImpl method fillSource.
private static void fillSource(final List<SourceReference> sources, final YangIdentifier sourceName, final Optional<Revision> revision, final Set<Uri> uris) {
final var sourceId = RevisionSourceIdentifier.create(sourceName.getValue(), revision);
final SourceReference sourceRef;
if (uris != null && uris.isEmpty()) {
final var locations = new ArrayList<URL>();
for (Uri uri : uris) {
try {
locations.add(new URL(uri.getValue()));
} catch (MalformedURLException e) {
LOG.debug("Ignoring invalid schema location {}", uri, e);
}
}
sourceRef = SourceReference.of(sourceId, locations);
} else {
sourceRef = SourceReference.of(sourceId);
}
sources.add(sourceRef);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160621.module.list.CommonLeafs.Revision in project netconf by opendaylight.
the class ModuleBuilderTest method testModuleBuilder.
@Test
public void testModuleBuilder() {
final ModuleBuilder moduleBuilder = new ModuleBuilder();
final Module.Revision revision = new Module.Revision(new RevisionIdentifier("2016-10-11"));
final YangIdentifier yangIdentifierOne = new YangIdentifier("YangIdentifier1");
final YangIdentifier yangIdentifierTwo = new YangIdentifier("YangIdentifier2");
final Uri namespace = new Uri("namespace");
final List<YangIdentifier> yangIdentifierList = ImmutableList.of(yangIdentifierOne, yangIdentifierTwo);
final ModuleKey moduleKeyOne = new ModuleKey(yangIdentifierOne, revision);
final ModuleKey moduleKeyTwo = new ModuleKey(moduleKeyOne);
moduleBuilder.setRevision(revision);
moduleBuilder.setDeviation(yangIdentifierList);
moduleBuilder.setFeature(yangIdentifierList);
moduleBuilder.setName(yangIdentifierOne);
moduleBuilder.setNamespace(namespace);
moduleBuilder.withKey(moduleKeyOne);
final Module moduleOne = moduleBuilder.build();
final Module moduleTwo = new ModuleBuilder(moduleOne).build();
assertNotNull(moduleBuilder);
assertNotNull(revision);
assertNotNull(yangIdentifierOne);
assertNotNull(yangIdentifierTwo);
assertNotNull(namespace);
assertNotNull(yangIdentifierList);
assertNotNull(moduleKeyOne);
assertNotNull(moduleKeyOne.hashCode());
assertNotNull(moduleKeyOne.toString());
assertNotNull(moduleBuilder.toString());
assertNotNull(moduleBuilder.hashCode());
assertEquals(moduleKeyOne, moduleKeyTwo);
assertEquals(revision, moduleKeyOne.getRevision());
assertEquals(yangIdentifierOne, moduleKeyOne.getName());
assertEquals(revision, moduleBuilder.getRevision());
assertEquals(yangIdentifierList, moduleBuilder.getDeviation());
assertEquals(yangIdentifierList, moduleBuilder.getFeature());
assertEquals(yangIdentifierOne, moduleBuilder.getName());
assertEquals(namespace, moduleBuilder.getNamespace());
assertEquals(moduleKeyOne, moduleBuilder.key());
assertEquals(moduleOne.toString(), moduleTwo.toString());
assertEquals(moduleKeyOne.toString(), moduleKeyTwo.toString());
assertTrue(moduleOne.equals(moduleTwo));
assertTrue(moduleKeyOne.equals(moduleKeyTwo));
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160621.module.list.CommonLeafs.Revision in project netconf by opendaylight.
the class ModuleRevisionBuilderTest method testModuleRevisionBuilder.
@Test
public void testModuleRevisionBuilder() {
final ModuleRevisionBuilder moduleRevisionBuilder = new ModuleRevisionBuilder();
assertNotNull(moduleRevisionBuilder);
final Revision revision = ModuleRevisionBuilder.getDefaultInstance("");
assertNotNull(revision);
assertEquals("", revision.getString());
assertEquals(null, revision.getRevisionIdentifier());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160621.module.list.CommonLeafs.Revision in project netconf by opendaylight.
the class RevisionBuilderTest method testEmptyString.
@Test
public void testEmptyString() {
final RevisionBuilder revisionBuilder = new RevisionBuilder();
assertNotNull(revisionBuilder);
final Revision revision = RevisionBuilder.getDefaultInstance("");
validate(revision, "", null);
}
Aggregations