use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.BridgeEntryKey in project netvirt by opendaylight.
the class QosNeutronUtils method getBridgeEntryFromConfigDS.
@Nullable
private BridgeEntry getBridgeEntryFromConfigDS(BigInteger dpnId) {
BridgeEntryKey bridgeEntryKey = new BridgeEntryKey(dpnId);
InstanceIdentifier<BridgeEntry> bridgeEntryInstanceIdentifier = getBridgeEntryIdentifier(bridgeEntryKey);
LOG.debug("Trying to retrieve bridge entry from config for Id: {}", bridgeEntryInstanceIdentifier);
return getBridgeEntryFromConfigDS(bridgeEntryInstanceIdentifier);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.BridgeEntryKey in project genius by opendaylight.
the class InterfaceManagerServiceImpl method getEndpointIpForDpn.
@Override
public ListenableFuture<GetEndpointIpForDpnOutput> getEndpointIpForDpn(GetEndpointIpForDpnInput input) {
BridgeEntryKey bridgeEntryKey = new BridgeEntryKey(input.getDpid());
InstanceIdentifier<BridgeEntry> bridgeEntryInstanceIdentifier = InterfaceMetaUtils.getBridgeEntryIdentifier(bridgeEntryKey);
BridgeEntry bridgeEntry = interfaceMetaUtils.getBridgeEntryFromConfigDS(bridgeEntryInstanceIdentifier);
// local ip of any of the bridge interface entry will be the dpn end
// point ip
BridgeInterfaceEntry bridgeInterfaceEntry = bridgeEntry.getBridgeInterfaceEntry().get(0);
InterfaceKey interfaceKey = new InterfaceKey(bridgeInterfaceEntry.getInterfaceName());
Interface interfaceInfo = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
IfTunnel tunnel = interfaceInfo.getAugmentation(IfTunnel.class);
return Futures.immediateFuture(new GetEndpointIpForDpnOutputBuilder().setLocalIps(Collections.singletonList(tunnel.getTunnelSource())).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.BridgeEntryKey in project genius by opendaylight.
the class InterfaceMetaUtils method getBridgeEntryFromConfigDS.
public BridgeEntry getBridgeEntryFromConfigDS(BigInteger dpnId) {
BridgeEntry bridgeEntry = getBridgeEntryFromCache(dpnId);
if (bridgeEntry != null) {
return bridgeEntry;
}
BridgeEntryKey bridgeEntryKey = new BridgeEntryKey(dpnId);
InstanceIdentifier<BridgeEntry> bridgeEntryInstanceIdentifier = InterfaceMetaUtils.getBridgeEntryIdentifier(bridgeEntryKey);
LOG.debug("Trying to retrieve bridge entry from config for Id: {}", bridgeEntryInstanceIdentifier);
bridgeEntry = readBridgeEntryFromConfigDS(bridgeEntryInstanceIdentifier);
if (bridgeEntry != null) {
addBridgeEntryToCache(dpnId, bridgeEntry);
}
return bridgeEntry;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.BridgeEntryKey in project genius by opendaylight.
the class InterfaceMetaUtils method deleteBridgeInterfaceEntry.
public void deleteBridgeInterfaceEntry(BridgeEntryKey bridgeEntryKey, List<BridgeInterfaceEntry> bridgeInterfaceEntries, InstanceIdentifier<BridgeEntry> bridgeEntryIid, String interfaceName) {
BridgeInterfaceEntryKey bridgeInterfaceEntryKey = new BridgeInterfaceEntryKey(interfaceName);
InstanceIdentifier<BridgeInterfaceEntry> bridgeInterfaceEntryIid = InterfaceMetaUtils.getBridgeInterfaceEntryIdentifier(bridgeEntryKey, bridgeInterfaceEntryKey);
if (bridgeInterfaceEntries.size() <= 1) {
batchingUtils.delete(bridgeEntryIid, BatchingUtils.EntityType.DEFAULT_CONFIG);
} else {
// No point deleting interface individually if bridge entry is being deleted
// Note: Will this cause issue in listener code? Does it expect separate notifications for two?
batchingUtils.delete(bridgeInterfaceEntryIid, BatchingUtils.EntityType.DEFAULT_CONFIG);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.BridgeEntryKey in project genius by opendaylight.
the class InterfaceManagerConfigurationTest method newTunnelInterface.
@Ignore
@Test
public void newTunnelInterface() throws Exception {
// 3. Update DPN-ID of the bridge
OvsdbSouthboundTestUtil.updateBridge(dataBroker, "00:00:00:00:00:00:00:02");
waitTillOperationCompletes(coordinatorEventsWaiter, asyncEventsWaiter);
BridgeRefEntryKey bridgeRefEntryKey = new BridgeRefEntryKey(DPN_ID_2);
InstanceIdentifier<BridgeRefEntry> bridgeRefEntryIid = InterfaceMetaUtils.getBridgeRefEntryIdentifier(bridgeRefEntryKey);
// Verify if DPN-ID is updated in corresponding DS and cache
BridgeRefEntry bridgeRefEntry = IfmUtil.read(LogicalDatastoreType.OPERATIONAL, bridgeRefEntryIid, dataBroker).orNull();
assertEqualBeans(interfaceMetaUtils.getBridgeRefEntryFromCache(DPN_ID_2), bridgeRefEntry);
// 1. Given
// 2. When
// i) dpn-id specified above configuration comes in
// operational/network-topology
// ii) Vlan interface written to config/ietf-interfaces DS and
// corresponding parent-interface is not present
// in operational/ietf-interface-state
ParentRefs parentRefs = new ParentRefsBuilder().setDatapathNodeIdentifier(DPN_ID_2).build();
InterfaceManagerTestUtil.putInterfaceConfig(dataBroker, TUNNEL_INTERFACE_NAME, parentRefs, Tunnel.class);
Thread.sleep(5000);
// 3. Then
// a) check expected bridge-interface mapping in
// odl-interface-meta/config/bridge-interface-info was created
BridgeEntryKey bridgeEntryKey = new BridgeEntryKey(DPN_ID_2);
BridgeInterfaceEntryKey bridgeInterfaceEntryKey = new BridgeInterfaceEntryKey(TUNNEL_INTERFACE_NAME);
InstanceIdentifier<BridgeInterfaceEntry> bridgeInterfaceEntryIid = InterfaceMetaUtils.getBridgeInterfaceEntryIdentifier(bridgeEntryKey, bridgeInterfaceEntryKey);
// TODO Later use nicer abstraction for DB access here.. see
// ElanServiceTest
assertEqualBeans(InterfaceMeta.newBridgeInterface(), dataBroker.newReadOnlyTransaction().read(CONFIGURATION, bridgeInterfaceEntryIid).checkedGet().get());
// Then
// a) check if termination end point is created in
// config/network-topology
final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node> bridgeIid = OvsdbSouthboundTestUtil.createInstanceIdentifier("192.168.56.101", 6640, "s2");
InstanceIdentifier<TerminationPoint> tpIid = InterfaceManagerTestUtil.getTerminationPointId(bridgeIid, TUNNEL_INTERFACE_NAME);
assertEqualTerminationPoints(ExpectedTerminationPoint.newTerminationPoint(), db.syncRead(CONFIGURATION, tpIid));
// When termination end point is populated in network-topology
OvsdbSouthboundTestUtil.createTerminationPoint(dataBroker, TUNNEL_INTERFACE_NAME, InterfaceTypeVxlan.class, null);
InterfaceManagerTestUtil.createFlowCapableNodeConnector(dataBroker, TUNNEL_INTERFACE_NAME, Tunnel.class);
waitTillOperationCompletes(coordinatorEventsWaiter, asyncEventsWaiter);
Thread.sleep(3000);
TestableQueues.awaitEmpty(batchingUtils.getQueue(DEFAULT_OPERATIONAL), 1, MINUTES);
// Then
// a) check if operational/ietf-interfaces-state is populated for the tunnel 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(TUNNEL_INTERFACE_NAME)).checkedGet().get();
assertEqualBeans(ExpectedInterfaceState.newInterfaceState(ifaceState.getIfIndex(), TUNNEL_INTERFACE_NAME, Interface.OperStatus.Up, Tunnel.class, DPN_ID_2.toString(), ifaceState.getStatistics().getDiscontinuityTime()), ifaceState);
// Test all RPCs related to tunnel interfaces
checkTunnelRpcs();
checkTunnelApis();
// Update test
// i) Enable Tunnel Monitoring
InterfaceManagerTestUtil.updateTunnelMonitoringAttributes(dataBroker, TUNNEL_INTERFACE_NAME);
InterfaceManagerTestUtil.waitTillOperationCompletes(coordinatorEventsWaiter, asyncEventsWaiter);
// Then verify if bfd attributes are updated in topology config DS
assertEqualTerminationPoints(ExpectedTerminationPoint.newBfdEnabledTerminationPoint(), db.syncRead(CONFIGURATION, tpIid));
// state modification tests
// 1. Make the operational state of port as DOWN
InterfaceManagerTestUtil.updateFlowCapableNodeConnectorState(dataBroker, TUNNEL_INTERFACE_NAME, Tunnel.class, false);
waitTillOperationCompletes(coordinatorEventsWaiter, asyncEventsWaiter);
ifaceState = dataBroker.newReadOnlyTransaction().read(OPERATIONAL, IfmUtil.buildStateInterfaceId(TUNNEL_INTERFACE_NAME)).checkedGet().get();
// Verify if operational/ietf-interface-state is still up
assertEqualBeans(ExpectedInterfaceState.newInterfaceState(ifaceState.getIfIndex(), TUNNEL_INTERFACE_NAME, Interface.OperStatus.Up, Tunnel.class, DPN_ID_2.toString(), ifaceState.getStatistics().getDiscontinuityTime()), ifaceState);
// 2. Make BFD staus of tunnel port as down
OvsdbSouthboundTestUtil.updateTerminationPoint(dataBroker, TUNNEL_INTERFACE_NAME, InterfaceTypeVxlan.class);
waitTillOperationCompletes(coordinatorEventsWaiter, asyncEventsWaiter);
ifaceState = dataBroker.newReadOnlyTransaction().read(OPERATIONAL, IfmUtil.buildStateInterfaceId(TUNNEL_INTERFACE_NAME)).checkedGet().get();
// Verify if operational/ietf-interface-state is marked down
assertEqualBeans(ExpectedInterfaceState.newInterfaceState(ifaceState.getIfIndex(), TUNNEL_INTERFACE_NAME, Interface.OperStatus.Down, Tunnel.class, DPN_ID_2.toString(), ifaceState.getStatistics().getDiscontinuityTime()), ifaceState);
// 2. Delete the Node
InterfaceManagerTestUtil.removeNode(dataBroker);
waitTillOperationCompletes(coordinatorEventsWaiter, asyncEventsWaiter);
ifaceState = dataBroker.newReadOnlyTransaction().read(OPERATIONAL, IfmUtil.buildStateInterfaceId(TUNNEL_INTERFACE_NAME)).checkedGet().get();
// Verify if operational/ietf-interface-state is marked unknown
assertEqualBeans(ExpectedInterfaceState.newInterfaceState(ifaceState.getIfIndex(), TUNNEL_INTERFACE_NAME, Interface.OperStatus.Unknown, Tunnel.class, DPN_ID_2.toString(), ifaceState.getStatistics().getDiscontinuityTime()), ifaceState);
// Re-create port to proceed with further tests
InterfaceManagerTestUtil.createFlowCapableNodeConnector(dataBroker, TUNNEL_INTERFACE_NAME, Tunnel.class);
waitTillOperationCompletes(coordinatorEventsWaiter, asyncEventsWaiter);
// 2. Delete the OF port
InterfaceManagerTestUtil.removeFlowCapableNodeConnectorState(dataBroker, Tunnel.class);
waitTillOperationCompletes(coordinatorEventsWaiter, asyncEventsWaiter);
// Verify if operational-states are deleted
Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(OPERATIONAL, IfmUtil.buildStateInterfaceId(TUNNEL_INTERFACE_NAME)).get());
Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(OPERATIONAL, IfmUtil.buildStateInterfaceId(TUNNEL_INTERFACE_NAME)).get());
// Delete test
// iii) tunnel interface is deleted from config/ietf-interfaces
InterfaceManagerTestUtil.deleteInterfaceConfig(dataBroker, TUNNEL_INTERFACE_NAME);
InterfaceManagerTestUtil.waitTillOperationCompletes(coordinatorEventsWaiter, asyncEventsWaiter);
// Then
// a) check if tunnel is deleted from bridge-interface-info
Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(CONFIGURATION, bridgeInterfaceEntryIid).get());
// b) check if termination end point is deleted in
// config/network-topology
Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(CONFIGURATION, tpIid).get());
waitTillOperationCompletes(coordinatorEventsWaiter, asyncEventsWaiter);
}
Aggregations