Search in sources :

Example 11 with ConfigTransactionClient

use of org.opendaylight.controller.config.util.ConfigTransactionClient in project controller by opendaylight.

the class TransactionProvider method abortTestTransaction.

public synchronized void abortTestTransaction(final ObjectName testTx) {
    LOG.debug("Aborting transaction {}", testTx);
    ConfigTransactionClient transactionClient = configRegistryClient.getConfigTransactionClient(testTx);
    allOpenedTransactions.remove(testTx);
    transactionClient.abortConfig();
}
Also used : ConfigTransactionClient(org.opendaylight.controller.config.util.ConfigTransactionClient)

Example 12 with ConfigTransactionClient

use of org.opendaylight.controller.config.util.ConfigTransactionClient in project controller by opendaylight.

the class TransactionProvider method validateTestTransaction.

public void validateTestTransaction(final ObjectName taON) throws ValidationException {
    ConfigTransactionClient transactionClient = configRegistryClient.getConfigTransactionClient(taON);
    transactionClient.validateConfig();
}
Also used : ConfigTransactionClient(org.opendaylight.controller.config.util.ConfigTransactionClient)

Example 13 with ConfigTransactionClient

use of org.opendaylight.controller.config.util.ConfigTransactionClient in project controller by opendaylight.

the class TransactionProvider method wipeInternal.

/**
 * Wiping means removing all module instances keeping the transaction open +
 * service references.
 */
synchronized void wipeInternal(final ObjectName taON, final boolean isTest) {
    ConfigTransactionClient transactionClient = configRegistryClient.getConfigTransactionClient(taON);
    Set<ObjectName> lookupConfigBeans = transactionClient.lookupConfigBeans();
    int index = lookupConfigBeans.size();
    for (ObjectName instance : lookupConfigBeans) {
        try {
            transactionClient.destroyModule(instance);
        } catch (final InstanceNotFoundException e) {
            if (isTest) {
                LOG.debug("Unable to clean configuration in transactiom {}", taON, e);
            } else {
                LOG.warn("Unable to clean configuration in transactiom {}", taON, e);
            }
            throw new IllegalStateException("Unable to clean configuration in transactiom " + taON, e);
        }
    }
    LOG.debug("Transaction {} wiped clean of {} config beans", taON, index);
    transactionClient.removeAllServiceReferences();
    LOG.debug("Transaction {} wiped clean of all service references", taON);
}
Also used : InstanceNotFoundException(javax.management.InstanceNotFoundException) ConfigTransactionClient(org.opendaylight.controller.config.util.ConfigTransactionClient) ObjectName(javax.management.ObjectName)

Aggregations

ConfigTransactionClient (org.opendaylight.controller.config.util.ConfigTransactionClient)13 ObjectName (javax.management.ObjectName)10 HashMap (java.util.HashMap)1 Map (java.util.Map)1 InstanceNotFoundException (javax.management.InstanceNotFoundException)1 Test (org.junit.Test)1 Config (org.opendaylight.controller.config.facade.xml.mapping.config.Config)1 InstanceConfig (org.opendaylight.controller.config.facade.xml.mapping.config.InstanceConfig)1 ModuleConfig (org.opendaylight.controller.config.facade.xml.mapping.config.ModuleConfig)1 ServiceRegistryWrapper (org.opendaylight.controller.config.facade.xml.mapping.config.ServiceRegistryWrapper)1 YangStoreContext (org.opendaylight.controller.config.facade.xml.osgi.YangStoreContext)1 InstanceRuntime (org.opendaylight.controller.config.facade.xml.runtime.InstanceRuntime)1 ModuleRuntime (org.opendaylight.controller.config.facade.xml.runtime.ModuleRuntime)1 Runtime (org.opendaylight.controller.config.facade.xml.runtime.Runtime)1 AbstractConfigTest (org.opendaylight.controller.config.manager.impl.AbstractConfigTest)1 XmlElement (org.opendaylight.controller.config.util.xml.XmlElement)1 Element (org.w3c.dom.Element)1