use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntryKey in project genius by opendaylight.
the class InterfaceManagerConfigurationTest method testVlanMemberInterface.
public void testVlanMemberInterface() throws Exception {
// Test VlanMember interface creation
InterfaceManagerTestUtil.putVlanInterfaceConfig(dataBroker, TRUNK_INTERFACE_NAME, INTERFACE_NAME, IfL2vlan.L2vlanMode.TrunkMember);
InterfaceManagerTestUtil.waitTillOperationCompletes("create vlan member interface", coordinatorEventsWaiter, 7, asyncEventsWaiter);
// 3. Then
// a) check expected interface-child entry mapping in odl-interface-meta/config/interface-child-info was created
InstanceIdentifier<InterfaceChildEntry> interfaceChildEntryInstanceIdentifier = InterfaceMetaUtils.getInterfaceChildEntryIdentifier(new InterfaceParentEntryKey(INTERFACE_NAME), new InterfaceChildEntryKey(TRUNK_INTERFACE_NAME));
assertEqualBeans(ExpectedInterfaceChildEntry.interfaceChildEntry(TRUNK_INTERFACE_NAME), dataBroker.newReadOnlyTransaction().read(CONFIGURATION, interfaceChildEntryInstanceIdentifier).checkedGet().get());
// Then
// a) check if operational/ietf-interfaces-state is populated for the vlan interface
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifaceState = dataBroker.newReadOnlyTransaction().read(OPERATIONAL, IfmUtil.buildStateInterfaceId(TRUNK_INTERFACE_NAME)).checkedGet().get();
assertEqualBeans(ExpectedInterfaceState.newInterfaceState(ifaceState.getIfIndex(), TRUNK_INTERFACE_NAME, Interface.OperStatus.Up, L2vlan.class, DPN_ID_1.toString(), ifaceState.getStatistics().getDiscontinuityTime()), ifaceState);
// FIXME can assert this only once ResourceBatchingManager becomes testable
// b) check if lport-tag to interface mapping is created
/*InstanceIdentifier<IfIndexInterface> ifIndexInterfaceInstanceIdentifier = InstanceIdentifier.builder(
IfIndexesInterfaceMap.class).child(
IfIndexInterface.class, new IfIndexInterfaceKey(ifaceState.getIfIndex())).build();
Assert.assertEquals(TRUNK_INTERFACE_NAME, dataBroker.newReadOnlyTransaction().read(OPERATIONAL,
ifIndexInterfaceInstanceIdentifier).checkedGet().get().getInterfaceName());*/
// Update test
// i) vlan member interface admin-state updated
InterfaceManagerTestUtil.updateInterfaceAdminState(dataBroker, TRUNK_INTERFACE_NAME, false);
InterfaceManagerTestUtil.waitTillOperationCompletes("update vlan member interface admin state", coordinatorEventsWaiter, 2, asyncEventsWaiter);
// Then
// a) check if operational/ietf-interfaces-state is updated for vlan interface
ifaceState = dataBroker.newReadOnlyTransaction().read(OPERATIONAL, IfmUtil.buildStateInterfaceId(TRUNK_INTERFACE_NAME)).checkedGet().get();
assertEqualBeans(ExpectedInterfaceState.newInterfaceState(ifaceState.getIfIndex(), TRUNK_INTERFACE_NAME, Interface.OperStatus.Down, L2vlan.class, DPN_ID_1.toString(), ifaceState.getStatistics().getDiscontinuityTime()), ifaceState);
InterfaceManagerTestUtil.deleteInterfaceConfig(dataBroker, TRUNK_INTERFACE_NAME);
InterfaceManagerTestUtil.waitTillOperationCompletes("delete vlan member interface", coordinatorEventsWaiter, 7, asyncEventsWaiter);
// 1. Then
// a)
Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(CONFIGURATION, interfaceChildEntryInstanceIdentifier).get());
// b) check if operational/ietf-interfaces-state is deleted for the vlan interface
Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(OPERATIONAL, IfmUtil.buildStateInterfaceId(TRUNK_INTERFACE_NAME)).get());
// FIXME can assert this only once ResourceBatchingManager becomes testable
// c) check if lport-tag to interface mapping is deleted
/*Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(OPERATIONAL,
ifIndexInterfaceInstanceIdentifier).get());*/
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntryKey in project genius by opendaylight.
the class InterfaceManagerCommonUtils method deleteInterfaceChildEntry.
public void deleteInterfaceChildEntry(String parentInterface, String childInterface) {
InterfaceParentEntryKey interfaceParentEntryKey = new InterfaceParentEntryKey(parentInterface);
InterfaceChildEntryKey interfaceChildEntryKey = new InterfaceChildEntryKey(childInterface);
InstanceIdentifier<InterfaceChildEntry> intfId = InterfaceMetaUtils.getInterfaceChildEntryIdentifier(interfaceParentEntryKey, interfaceChildEntryKey);
batchingUtils.delete(intfId, BatchingUtils.EntityType.DEFAULT_CONFIG);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntryKey in project genius by opendaylight.
the class OvsVlanMemberConfigRemoveHelper method removeConfiguration.
public List<ListenableFuture<Void>> removeConfiguration(ParentRefs parentRefs, Interface interfaceOld) {
LOG.debug("remove vlan member configuration {}", interfaceOld.getName());
List<ListenableFuture<Void>> futures = new ArrayList<>();
InterfaceParentEntryKey interfaceParentEntryKey = new InterfaceParentEntryKey(parentRefs.getParentInterface());
InstanceIdentifier<InterfaceParentEntry> interfaceParentEntryIid = InterfaceMetaUtils.getInterfaceParentEntryIdentifier(interfaceParentEntryKey);
InterfaceParentEntry interfaceParentEntry = interfaceMetaUtils.getInterfaceParentEntryFromConfigDS(interfaceParentEntryIid);
if (interfaceParentEntry == null) {
return futures;
}
// Configuration changes
futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
// Delete the interface child information
List<InterfaceChildEntry> interfaceChildEntries = interfaceParentEntry.getInterfaceChildEntry();
InterfaceChildEntryKey interfaceChildEntryKey = new InterfaceChildEntryKey(interfaceOld.getName());
InstanceIdentifier<InterfaceChildEntry> interfaceChildEntryIid = InterfaceMetaUtils.getInterfaceChildEntryIdentifier(interfaceParentEntryKey, interfaceChildEntryKey);
tx.delete(LogicalDatastoreType.CONFIGURATION, interfaceChildEntryIid);
// If this is the last child, remove the interface parent info as well.
if (interfaceChildEntries.size() <= 1) {
tx.delete(LogicalDatastoreType.CONFIGURATION, interfaceParentEntryIid);
}
}));
// Operational changes
futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = interfaceManagerCommonUtils.getInterfaceState(parentRefs.getParentInterface());
if (ifState != null) {
LOG.debug("delete vlan member interface state {}", interfaceOld.getName());
BigInteger dpId = IfmUtil.getDpnFromInterface(ifState);
interfaceManagerCommonUtils.deleteInterfaceStateInformation(interfaceOld.getName(), tx);
FlowBasedServicesUtils.removeIngressFlow(interfaceOld.getName(), dpId, txRunner, futures);
}
}));
return futures;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntryKey in project genius by opendaylight.
the class OvsInterfaceConfigUpdateHelper method handleInterfaceAdminStateUpdates.
private void handleInterfaceAdminStateUpdates(WriteTransaction transaction, Interface interfaceNew, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState) {
IfL2vlan ifL2vlan = interfaceNew.getAugmentation(IfL2vlan.class);
if (ifL2vlan == null || IfL2vlan.L2vlanMode.Trunk != ifL2vlan.getL2vlanMode() && IfL2vlan.L2vlanMode.Transparent != ifL2vlan.getL2vlanMode()) {
return;
}
LOG.info("admin-state modified for interface {}", interfaceNew.getName());
OperStatus operStatus = interfaceManagerCommonUtils.updateStateEntry(interfaceNew, transaction, ifState);
InterfaceParentEntryKey interfaceParentEntryKey = new InterfaceParentEntryKey(interfaceNew.getName());
InterfaceParentEntry interfaceParentEntry = interfaceMetaUtils.getInterfaceParentEntryFromConfigDS(interfaceParentEntryKey);
if (interfaceParentEntry == null || interfaceParentEntry.getInterfaceChildEntry() == null) {
return;
}
VlanMemberStateUpdateWorker vlanMemberStateUpdateWorker = new VlanMemberStateUpdateWorker(txRunner, operStatus, interfaceParentEntry.getInterfaceChildEntry());
coordinator.enqueueJob(interfaceNew.getName(), vlanMemberStateUpdateWorker, IfmConstants.JOB_MAX_RETRIES);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntryKey in project genius by opendaylight.
the class InterfaceManagerCommonUtils method createInterfaceChildEntry.
private void createInterfaceChildEntry(String parentInterface, String childInterface, Consumer<Pair<InstanceIdentifier<InterfaceChildEntry>, InterfaceChildEntry>> writer) {
InterfaceParentEntryKey interfaceParentEntryKey = new InterfaceParentEntryKey(parentInterface);
InterfaceChildEntryKey interfaceChildEntryKey = new InterfaceChildEntryKey(childInterface);
InstanceIdentifier<InterfaceChildEntry> interfaceChildEntryIdentifier = InterfaceMetaUtils.getInterfaceChildEntryIdentifier(interfaceParentEntryKey, interfaceChildEntryKey);
InterfaceChildEntry interfaceChildEntry = new InterfaceChildEntryBuilder().setKey(interfaceChildEntryKey).setChildInterface(childInterface).build();
writer.accept(Pair.of(interfaceChildEntryIdentifier, interfaceChildEntry));
}
Aggregations