use of org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker in project netvirt by opendaylight.
the class ElanL2GatewayMulticastUtils method getRemoteBCGroupBucketsOfElanExternalTeps.
public List<Bucket> getRemoteBCGroupBucketsOfElanExternalTeps(ElanInstance elanInfo, BigInteger dpnId, int bucketId) {
ElanInstance operElanInstance = null;
try {
operElanInstance = new SingleTransactionDataBroker(broker).syncReadOptional(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class, elanInfo.getKey()).build()).orNull();
} catch (ReadFailedException e) {
LOG.error("Failed to read elan instance operational path {}", elanInfo, e);
return emptyList();
}
if (operElanInstance == null) {
return emptyList();
}
List<ExternalTeps> teps = operElanInstance.getExternalTeps();
if (teps == null || teps.isEmpty()) {
return emptyList();
}
List<Bucket> listBucketInfo = new ArrayList<>();
for (ExternalTeps tep : teps) {
String externalTep = tep.getNodeid() != null ? tep.getNodeid() : tep.getTepIp().toString();
String interfaceName = elanItmUtils.getExternalTunnelInterfaceName(String.valueOf(dpnId), externalTep);
if (interfaceName == null) {
LOG.error("Could not get interface name to ext tunnel {} {}", dpnId, tep.getTepIp());
continue;
}
List<Action> listActionInfo = elanItmUtils.buildTunnelItmEgressActions(interfaceName, elanUtils.getVxlanSegmentationId(elanInfo));
listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
}
return listBucketInfo;
}
use of org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker in project netvirt by opendaylight.
the class UpgradeStateListener method update.
@Override
public void update(@Nonnull Config original, Config updated) {
if (natMode != NatserviceConfig.NatMode.Conntrack) {
return;
}
LOG.info("UpgradeStateListener update from {} to {}", original, updated);
if (!(original.isUpgradeInProgress() && !updated.isUpgradeInProgress())) {
return;
}
SingleTransactionDataBroker reader = new SingleTransactionDataBroker(dataBroker);
ExtRouters routers;
try {
routers = reader.syncRead(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(ExtRouters.class));
} catch (ReadFailedException e) {
LOG.error("Error reading external routers", e);
return;
}
for (Routers router : routers.getRouters()) {
List<ExternalIps> externalIps = router.getExternalIps();
if (router.isEnableSnat() && externalIps != null && !externalIps.isEmpty()) {
centralizedSwitchScheduler.scheduleCentralizedSwitch(router);
}
}
}
use of org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker in project netvirt by opendaylight.
the class AclLiveStatisticsRpcServiceTest method setUp.
@Before
public void setUp() throws Exception {
aclStatsService = new AclLiveStatisticsRpcServiceImpl(config, dataBroker, odlDirectStatsService);
singleTransactionDataBroker = new SingleTransactionDataBroker(dataBroker);
LOG.info("Acl mode: {}", config.getSecurityGroupMode());
newElan(ELAN, ELAN_TAG);
newElanInterface(ELAN, PORT_1, true);
Pair<DataTreeIdentifier<Interface>, Interface> port1 = new IdentifiedInterfaceWithAclBuilder().interfaceName(PORT_1).portSecurity(true).build();
dataBrokerUtil.put(port1);
testInterfaceManager.addInterface(port1.getValue());
putNewStateInterface(dataBroker, "port1", PORT_MAC_1);
asyncEventsWaiter.awaitEventsConsumption();
}
use of org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker in project netvirt by opendaylight.
the class AclServiceTestBase method beforeEachTest.
@Before
public void beforeEachTest() throws Exception {
singleTransactionDataBroker = new SingleTransactionDataBroker(dataBroker);
setUpData();
}
Aggregations