use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey in project genius by opendaylight.
the class InterfaceManagerTestUtil method updateInterfaceAdminState.
static void updateInterfaceAdminState(DataBroker dataBroker, String ifaceName, boolean isEnabled) throws TransactionCommitFailedException {
InstanceIdentifier<Interface> vlanInterfaceEnabledInterfaceInstanceIdentifier = IfmUtil.buildId(ifaceName);
InterfaceBuilder builder = new InterfaceBuilder().setKey(new InterfaceKey(ifaceName)).setName(ifaceName).setEnabled(isEnabled);
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
tx.merge(CONFIGURATION, vlanInterfaceEnabledInterfaceInstanceIdentifier, builder.build());
tx.submit().checkedGet();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey in project genius by opendaylight.
the class OvsVlanMemberConfigAddHelper method addConfiguration.
public List<ListenableFuture<Void>> addConfiguration(ParentRefs parentRefs, Interface interfaceNew) {
LOG.info("adding vlan member configuration for interface {}", interfaceNew.getName());
List<ListenableFuture<Void>> futures = new ArrayList<>();
futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> interfaceManagerCommonUtils.createInterfaceChildEntry(parentRefs.getParentInterface(), interfaceNew.getName(), tx)));
InterfaceKey interfaceKey = new InterfaceKey(parentRefs.getParentInterface());
Interface ifaceParent = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
if (ifaceParent == null) {
LOG.info("Parent Interface: {} not found when adding child interface: {}", parentRefs.getParentInterface(), interfaceNew.getName());
return futures;
}
IfL2vlan parentIfL2Vlan = ifaceParent.getAugmentation(IfL2vlan.class);
if (parentIfL2Vlan == null || parentIfL2Vlan.getL2vlanMode() != IfL2vlan.L2vlanMode.Trunk) {
LOG.error("Parent Interface: {} not of trunk Type when adding trunk-member: {}", ifaceParent, interfaceNew);
return futures;
}
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = interfaceManagerCommonUtils.getInterfaceState(parentRefs.getParentInterface());
interfaceManagerCommonUtils.addStateEntry(interfaceNew.getName(), futures, ifState);
return futures;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey in project genius by opendaylight.
the class InterfaceInstanceRecoveryHandler method recoverService.
@Override
public void recoverService(String entityId) {
if (!entityOwnershipUtils.isEntityOwner(IfmConstants.INTERFACE_CONFIG_ENTITY, IfmConstants.INTERFACE_CONFIG_ENTITY)) {
return;
}
LOG.info("recover interface instance {}", entityId);
// Fetch the interface from interface config DS first.
Interface interfaceConfig = interfaceManagerCommonUtils.getInterfaceFromConfigDS(entityId);
if (interfaceConfig != null) {
// Do a delete and recreate of the interface configuration.
InstanceIdentifier<Interface> interfaceId = InterfaceManagerCommonUtils.getInterfaceIdentifier(new InterfaceKey(entityId));
LOG.trace("deleting interface instance {}", entityId);
jobCoordinator.enqueueJob(entityId, () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.delete(LogicalDatastoreType.CONFIGURATION, interfaceId))), IfmConstants.JOB_MAX_RETRIES);
LOG.trace("recreating interface instance {}, {}", entityId, interfaceConfig);
jobCoordinator.enqueueJob(entityId, () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.put(LogicalDatastoreType.CONFIGURATION, interfaceId, interfaceConfig))), IfmConstants.JOB_MAX_RETRIES);
}
}
Aggregations