use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.dpn.to._interface.InterfaceNameEntryKey in project genius by opendaylight.
the class InterfaceManagerConfigurationTest method createDpnToInterface.
private void createDpnToInterface(BigInteger dpId, String infName, Class<? extends InterfaceType> interfaceType) throws Exception {
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
DpnToInterfaceKey dpnToInterfaceKey = new DpnToInterfaceKey(dpId);
InterfaceNameEntryKey interfaceNameEntryKey = new InterfaceNameEntryKey(infName);
InstanceIdentifier<InterfaceNameEntry> intfid = InstanceIdentifier.builder(DpnToInterfaceList.class).child(DpnToInterface.class, dpnToInterfaceKey).child(InterfaceNameEntry.class, interfaceNameEntryKey).build();
InterfaceNameEntryBuilder entryBuilder = new InterfaceNameEntryBuilder().setKey(interfaceNameEntryKey).setInterfaceName(infName);
if (interfaceType != null) {
entryBuilder.setInterfaceType(interfaceType);
}
tx.put(LogicalDatastoreType.OPERATIONAL, intfid, entryBuilder.build(), true);
tx.submit().checkedGet();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.dpn.to._interface.InterfaceNameEntryKey in project genius by opendaylight.
the class InterfaceManagerCommonUtils method deleteDpnToInterface.
public void deleteDpnToInterface(BigInteger dpId, String infName, WriteTransaction transaction) {
DpnToInterfaceKey dpnToInterfaceKey = new DpnToInterfaceKey(dpId);
InstanceIdentifier<DpnToInterface> dpnToInterfaceId = InstanceIdentifier.builder(DpnToInterfaceList.class).child(DpnToInterface.class, dpnToInterfaceKey).build();
Optional<DpnToInterface> dpnToInterfaceOptional = IfmUtil.read(LogicalDatastoreType.OPERATIONAL, dpnToInterfaceId, dataBroker);
if (!dpnToInterfaceOptional.isPresent()) {
LOG.debug("DPN {} is already removed from the Operational DS", dpId);
return;
}
List<InterfaceNameEntry> interfaceNameEntries = dpnToInterfaceOptional.get().getInterfaceNameEntry();
InterfaceNameEntryKey interfaceNameEntryKey = new InterfaceNameEntryKey(infName);
InstanceIdentifier<InterfaceNameEntry> intfid = InstanceIdentifier.builder(DpnToInterfaceList.class).child(DpnToInterface.class, dpnToInterfaceKey).child(InterfaceNameEntry.class, interfaceNameEntryKey).build();
transaction.delete(LogicalDatastoreType.OPERATIONAL, intfid);
if (interfaceNameEntries.size() <= 1) {
transaction.delete(LogicalDatastoreType.OPERATIONAL, dpnToInterfaceId);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.dpn.to._interface.InterfaceNameEntryKey in project genius by opendaylight.
the class InterfaceManagerCommonUtils method createOrUpdateDpnToInterface.
public void createOrUpdateDpnToInterface(BigInteger dpId, String infName, Class<? extends InterfaceType> interfaceType) {
DpnToInterfaceKey dpnToInterfaceKey = new DpnToInterfaceKey(dpId);
InterfaceNameEntryKey interfaceNameEntryKey = new InterfaceNameEntryKey(infName);
InstanceIdentifier<InterfaceNameEntry> intfid = InstanceIdentifier.builder(DpnToInterfaceList.class).child(DpnToInterface.class, dpnToInterfaceKey).child(InterfaceNameEntry.class, interfaceNameEntryKey).build();
InterfaceNameEntryBuilder entryBuilder = new InterfaceNameEntryBuilder().setKey(interfaceNameEntryKey).setInterfaceName(infName);
if (interfaceType != null) {
entryBuilder.setInterfaceType(interfaceType);
}
batchingUtils.write(intfid, entryBuilder.build(), BatchingUtils.EntityType.DEFAULT_OPERATIONAL);
}
Aggregations