Yang does not allow attributes in different cases to have the same name.
In yang modules for config, the configuration is located in cases and if 2 cases in same yang module contain child with same name, the transformation of data from CompositeNode to NormalizedNode
NOTE: This might break bgpcep and SP distribution, check.
Change-Id: I9bad24df9ac149da74b745ff648c72345e33deb1
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
@Override
protected void customValidation(){
- JmxAttributeValidationException.checkNotNull(getTimeout(), "value is not set.", timeoutJmxAttribute);
- JmxAttributeValidationException.checkCondition(getTimeout() >= 0, "value " + getTimeout() + " is less than 0",
- timeoutJmxAttribute);
+ JmxAttributeValidationException.checkNotNull(getReconnectTimeout(), "value is not set.", reconnectTimeoutJmxAttribute);
+ JmxAttributeValidationException.checkCondition(getReconnectTimeout() >= 0, "value " + getReconnectTimeout() + " is less than 0",
+ reconnectTimeoutJmxAttribute);
}
@Override
public java.lang.AutoCloseable createInstance() {
- return new ReconnectImmediatelyStrategyFactoryCloseable(getExecutorDependency(), getTimeout());
+ return new ReconnectImmediatelyStrategyFactoryCloseable(getReconnectExecutorDependency(), getReconnectTimeout());
}
private static final class ReconnectImmediatelyStrategyFactoryCloseable implements ReconnectStrategyFactory, AutoCloseable {
@Override
public java.lang.AutoCloseable createInstance() {
- return new TimedReconnectStrategyFactoryCloseable(getExecutorDependency(),
+ return new TimedReconnectStrategyFactoryCloseable(getTimedReconnectExecutorDependency(),
getConnectTime(), getMinSleep(), getSleepFactor().doubleValue(), getMaxSleep(), getMaxAttempts(),
getDeadline());
}
case reconnect-immediately-strategy-factory {
when "/config:modules/config:module/config:type = 'reconnect-immediately-strategy-factory'";
- leaf timeout {
+ leaf reconnect-timeout {
mandatory true;
type int32;
}
- container executor {
+ container reconnect-executor {
uses config:service-ref {
refine type {
mandatory true;
units "milliseconds";
}
- container executor {
+ container timed-reconnect-executor {
uses config:service-ref {
refine type {
mandatory true;
final ReconnectImmediatelyStrategyFactoryModuleMXBean mxBean = transaction.newMBeanProxy(
transaction.lookupConfigBean(FACTORY_NAME, INSTANCE_NAME),
ReconnectImmediatelyStrategyFactoryModuleMXBean.class);
- mxBean.setTimeout(200);
+ mxBean.setReconnectTimeout(200);
final CommitStatus status = transaction.commit();
assertBeanCount(1, FACTORY_NAME);
assertStatus(status, 0, 1, 1);
final ObjectName nameCreated = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
final ReconnectImmediatelyStrategyFactoryModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated,
ReconnectImmediatelyStrategyFactoryModuleMXBean.class);
- mxBean.setTimeout(timeout);
- mxBean.setExecutor(GlobalEventExecutorUtil.create(transaction));
+ mxBean.setReconnectTimeout(timeout);
+ mxBean.setReconnectExecutor(GlobalEventExecutorUtil.create(transaction));
return nameCreated;
}
*/
package org.opendaylight.controller.config.yang.protocol.framework;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.math.BigDecimal;
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.ObjectName;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.config.api.ConflictingVersionException;
import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
import org.opendaylight.controller.config.yang.netty.eventexecutor.GlobalEventExecutorModuleFactory;
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.ObjectName;
-import java.math.BigDecimal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
public class TimedReconnectStrategyModuleTest extends AbstractConfigTest {
private static final String INSTANCE_NAME = "timed-reconect-stategy-facotry-impl";
mxBean.setMaxSleep(maxSleep);
mxBean.setMinSleep(minSleep);
mxBean.setSleepFactor(sleepFactor);
- mxBean.setExecutor(GlobalEventExecutorUtil.create(transaction));
+ mxBean.setTimedReconnectExecutor(GlobalEventExecutorUtil.create(transaction));
return nameCreated;
}
<module>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider">prefix:inmemory-operational-datastore-provider</type>
<name>operational-store-service</name>
- <schema-service>
+ <operational-schema-service>
<type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
<name>yang-schema-service</name>
- </schema-service>
+ </operational-schema-service>
</module>
<!--
Tree-based in-memory data store. This is the data store which is currently
@Override
public java.lang.AutoCloseable createInstance() {
InMemoryDOMDataStore ids = new InMemoryDOMDataStore("DOM-OPER", MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor()));
- getSchemaServiceDependency().registerSchemaServiceListener(ids);
+ getOperationalSchemaServiceDependency().registerSchemaServiceListener(ids);
return ids;
}
case inmemory-operational-datastore-provider {
when "/config:modules/config:module/config:type = 'inmemory-operational-datastore-provider'";
- container schema-service {
+ // Yang does not allow two cases from same namespaces with same children
+ // Schema-service dependency renamed to operational-schema-service
+ // to prevent conflict with schema-service container from inmemory-config-datastore-provider
+ container operational-schema-service {
uses config:service-ref {
refine type {
mandatory false;