use of org.opendaylight.yangtools.yang.model.api.SchemaPath in project controller by opendaylight.
the class BindingToNormalizedNodeCodec method getRpcMethodToSchemaPath.
// FIXME: This should be probably part of Binding Runtime context
public ImmutableBiMap<Method, SchemaPath> getRpcMethodToSchemaPath(final Class<? extends RpcService> key) {
final Module module = getModuleBlocking(key);
final ImmutableBiMap.Builder<Method, SchemaPath> ret = ImmutableBiMap.<Method, SchemaPath>builder();
try {
for (final RpcDefinition rpcDef : module.getRpcs()) {
final Method method = findRpcMethod(key, rpcDef);
ret.put(method, rpcDef.getPath());
}
} catch (final NoSuchMethodException e) {
throw new IllegalStateException("Rpc defined in model does not have representation in generated class.", e);
}
return ret.build();
}
use of org.opendaylight.yangtools.yang.model.api.SchemaPath in project controller by opendaylight.
the class DOMRpcRoutingTable method add.
DOMRpcRoutingTable add(final DOMRpcImplementation implementation, final Set<DOMRpcIdentifier> rpcsToAdd) {
if (rpcsToAdd.isEmpty()) {
return this;
}
// First decompose the identifiers to a multimap
final ListMultimap<SchemaPath, YangInstanceIdentifier> toAdd = decomposeIdentifiers(rpcsToAdd);
// Now iterate over existing entries, modifying them as appropriate...
final Builder<SchemaPath, AbstractDOMRpcRoutingTableEntry> mb = ImmutableMap.builder();
for (Entry<SchemaPath, AbstractDOMRpcRoutingTableEntry> re : this.rpcs.entrySet()) {
List<YangInstanceIdentifier> newRpcs = new ArrayList<>(toAdd.removeAll(re.getKey()));
if (!newRpcs.isEmpty()) {
final AbstractDOMRpcRoutingTableEntry ne = re.getValue().add(implementation, newRpcs);
mb.put(re.getKey(), ne);
} else {
mb.put(re);
}
}
// Finally add whatever is left in the decomposed multimap
for (Entry<SchemaPath, Collection<YangInstanceIdentifier>> e : toAdd.asMap().entrySet()) {
final Builder<YangInstanceIdentifier, List<DOMRpcImplementation>> vb = ImmutableMap.builder();
final List<DOMRpcImplementation> v = Collections.singletonList(implementation);
for (YangInstanceIdentifier i : e.getValue()) {
vb.put(i, v);
}
mb.put(e.getKey(), createRpcEntry(schemaContext, e.getKey(), vb.build()));
}
return new DOMRpcRoutingTable(mb.build(), schemaContext);
}
use of org.opendaylight.yangtools.yang.model.api.SchemaPath in project controller by opendaylight.
the class TopicDOMNotificationTest method getTypeTest.
@Test
public void getTypeTest() {
SchemaPath topicNotificationId = SchemaPath.create(true, TopicNotification.QNAME);
assertEquals("Type has not been created correctly.", topicNotificationId, topicDOMNotification.getType());
}
use of org.opendaylight.yangtools.yang.model.api.SchemaPath in project controller by opendaylight.
the class UtilTest method createSchemaPathList.
private static List<SchemaPath> createSchemaPathList() {
final QName qname1 = QName.create("urn:odl:xxx", "2015-01-01", "localName");
final QName qname2 = QName.create("urn:odl:yyy", "2015-01-01", "localName");
final SchemaPath path1 = SchemaPath.create(true, qname1);
final SchemaPath path2 = SchemaPath.create(true, qname2);
return Arrays.asList(path1, path2);
}
use of org.opendaylight.yangtools.yang.model.api.SchemaPath in project bgpcep by opendaylight.
the class ConfigLoaderImplTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
final SchemaPath schemaPath = SchemaPath.create(true, NetworkInstances.QNAME, NetworkInstance.QNAME, Protocols.QNAME);
doReturn(schemaPath).when(this.processor).getSchemaPath();
doReturn("processor").when(this.processor).toString();
}
Aggregations