use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.inter.vpn.link.rev160311.InterVpnLinkStates in project netvirt by opendaylight.
the class InterVpnLinkCacheImpl method initialFeed.
@PostConstruct
public void initialFeed() {
// Read all InterVpnLinks and InterVpnLinkStates from MD-SAL.
InstanceIdentifier<InterVpnLinks> interVpnLinksIid = InstanceIdentifier.builder(InterVpnLinks.class).build();
Optional<InterVpnLinks> optIVpnLinksOpData = MDSALUtil.read(dataBroker, LogicalDatastoreType.CONFIGURATION, interVpnLinksIid);
if (!optIVpnLinksOpData.isPresent()) {
// Nothing to be added to cache
return;
}
InterVpnLinks interVpnLinks = optIVpnLinksOpData.get();
for (InterVpnLink interVpnLink : interVpnLinks.getInterVpnLink()) {
addInterVpnLinkToCaches(interVpnLink);
}
// Now the States
InstanceIdentifier<InterVpnLinkStates> interVpnLinkStateIid = InstanceIdentifier.builder(InterVpnLinkStates.class).build();
Optional<InterVpnLinkStates> optIVpnLinkStateOpData = MDSALUtil.read(dataBroker, LogicalDatastoreType.CONFIGURATION, interVpnLinkStateIid);
if (!optIVpnLinkStateOpData.isPresent()) {
return;
}
InterVpnLinkStates interVpnLinkStates = optIVpnLinkStateOpData.get();
for (InterVpnLinkState interVpnLinkState : interVpnLinkStates.getInterVpnLinkState()) {
addInterVpnLinkStateToCaches(interVpnLinkState);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.inter.vpn.link.rev160311.InterVpnLinkStates in project netvirt by opendaylight.
the class InterVpnLinkLocatorTest method setUp.
@Before
public void setUp() throws Exception {
dataBroker = getDataBroker();
// Creating both empty containers: InterVpnLinks and InterVpnLinkStates
WriteTransaction writeTx = dataBroker.newWriteOnlyTransaction();
writeTx.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.builder(InterVpnLinks.class).build(), new InterVpnLinksBuilder().setInterVpnLink(Collections.emptyList()).build(), true);
writeTx.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.builder(InterVpnLinkStates.class).build(), new InterVpnLinkStatesBuilder().setInterVpnLinkState(Collections.emptyList()).build(), true);
writeTx.submit().checkedGet();
interVpnLinkCache = new InterVpnLinkCacheImpl(dataBroker);
interVpnLinkCache.initialFeed();
// Prepare
populateL3Vpns(dataBroker, L3VpnTestCatalog.ALL_VPNS);
InterVpnLinkTestCatalog.populateIvpnLinks(dataBroker, ALL_IVPN_LINKS);
for (InterVpnLinkDataComposite ivl : ALL_IVPN_LINKS) {
interVpnLinkCache.addInterVpnLinkToCaches(ivl.getInterVpnLinkConfig());
interVpnLinkCache.addInterVpnLinkStateToCaches(ivl.getInterVpnLinkState());
}
// SUT
sut = new InterVpnLinkLocator(dataBroker, interVpnLinkCache);
}
Aggregations