mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-02 19:47:52 +00:00
Merged in NETEXP-3230 (pull request #21)
[NETEXP-3230] fix for not populating Node_Config table Approved-by: Ralph.lee
This commit is contained in:
committed by
Thomas-Leung2021
parent
3647fd6bec
commit
551db33074
@@ -145,8 +145,24 @@ public class OvsdbNodeConfig extends OvsdbDaoBase {
|
|||||||
List.of(new Condition("module", Function.EQUALS, new Atom<>("led"))), new Row(columns)));
|
List.of(new Condition("module", Function.EQUALS, new Atom<>("led"))), new Row(columns)));
|
||||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||||
|
long numUpdates = 0;
|
||||||
for (OperationResult res : result) {
|
for (OperationResult res : result) {
|
||||||
LOG.debug("processLedControlEnabled result {}", res);
|
if (res instanceof UpdateResult) {
|
||||||
|
numUpdates += ((UpdateResult) res).getCount();
|
||||||
|
LOG.debug("processLedControlEnabled update result {}", res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (numUpdates == 0) {
|
||||||
|
// no records existed, insert the row instead
|
||||||
|
operations.clear();
|
||||||
|
operations.add(new Insert(nodeConfigTable, new Row(columns)));
|
||||||
|
fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||||
|
result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||||
|
for (OperationResult res : result) {
|
||||||
|
if (res instanceof InsertResult) {
|
||||||
|
LOG.debug("processLedControlEnabled insert result {}", res);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (OvsdbClientException | InterruptedException | ExecutionException | TimeoutException e) {
|
} catch (OvsdbClientException | InterruptedException | ExecutionException | TimeoutException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user