use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntryKey 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._interface.parent.entry.InterfaceChildEntryKey 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._interface.parent.entry.InterfaceChildEntryKey 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._interface.parent.entry.InterfaceChildEntryKey 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));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntryKey in project genius by opendaylight.
the class ItmTunnelAggregationHelper method updateTunnelAggregationGroupBucket.
private void updateTunnelAggregationGroupBucket(Interface ifaceState, IfTunnel ifTunnel, ParentRefs parentRefs, InterfaceParentEntry groupParentEntry, int action, WriteTransaction tx) {
String logicTunnelName = parentRefs.getParentInterface();
List<InterfaceChildEntry> interfaceChildEntries = groupParentEntry.getInterfaceChildEntry();
if (interfaceChildEntries == null) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: empty child list in group {}", groupParentEntry.getParentInterface());
return;
}
String ifaceName = ifaceState.getName();
InterfaceChildEntry childEntry = new InterfaceChildEntryBuilder().setChildInterface(ifaceName).setKey(new InterfaceChildEntryKey(ifaceName)).build();
int bucketId = interfaceChildEntries.indexOf(childEntry);
if (bucketId == -1) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: wrong child id for {} in group {}", ifaceName, groupParentEntry.getParentInterface());
return;
}
InterfaceInfo ifLogicTunnel = interfaceManager.getInterfaceInfoFromOperationalDataStore(logicTunnelName);
long groupId = ifLogicTunnel != null ? interfaceManager.getLogicalTunnelSelectGroupId(ifLogicTunnel.getInterfaceTag()) : INVALID_ID;
if (groupId == INVALID_ID) {
LOG.warn("MULTIPLE_VxLAN_TUNNELS: unknown group id for logic tunnel {}", logicTunnelName);
return;
}
// openflow:dpnid:portnum
String lowerLayerIf = ifaceState.getLowerLayerIf().get(0);
String[] split = lowerLayerIf.split(IfmConstants.OF_URI_SEPARATOR);
BigInteger srcDpnId = new BigInteger(split[1]);
int portNumber = Integer.parseInt(split[2]);
if (action == ADD_TUNNEL) {
if (!mdsalManager.groupExists(srcDpnId, groupId)) {
createLogicalTunnelSelectGroup(srcDpnId, logicTunnelName, ifLogicTunnel.getInterfaceTag());
}
Bucket buckt = createBucket(ifaceName, ifTunnel, bucketId, portNumber);
LOG.debug("MULTIPLE_VxLAN_TUNNELS: add bucketId {} to groupId {}", bucketId, groupId);
mdsalManager.addBucketToTx(srcDpnId, groupId, buckt, tx);
} else {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: remove bucketId {} from groupId {}", bucketId, groupId);
mdsalManager.removeBucketToTx(srcDpnId, groupId, bucketId, tx);
}
}
Aggregations