Search in sources :

Example 56 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config 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());*/
}
Also used : IfL2vlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan) L2vlan(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan) Options(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options) AssertDataObjects.assertEqualBeans(org.opendaylight.mdsal.binding.testutils.AssertDataObjects.assertEqualBeans) InterfaceChildEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntryKey) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface) InterfaceParentEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntryKey) InterfaceChildEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntry) ExpectedInterfaceChildEntry(org.opendaylight.genius.interfacemanager.test.xtend.ExpectedInterfaceChildEntry)

Example 57 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project genius by opendaylight.

the class InterfaceManagerConfigurationTest method checkVlanApis.

private void checkVlanApis() throws Exception {
    // 1. Test port-no corresponding to interface
    long portNo = interfaceManager.getPortForInterface(INTERFACE_NAME);
    Assert.assertEquals(PORT_NO_1, portNo);
    // 2. fetch interface config from datastore API
    org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface interfaceInfo = interfaceManager.getInterfaceInfoFromConfigDataStore(INTERFACE_NAME);
    // FIXME change this once augmentation sorting fix lands
    assertEqualBeans(INTERFACE_NAME, interfaceInfo.getName());
    assertEqualBeans(PARENT_INTERFACE, interfaceInfo.getAugmentation(ParentRefs.class).getParentInterface());
    // 3. fetch dpn-id corresponding to an interface
    BigInteger dpnId = interfaceManager.getDpnForInterface(INTERFACE_NAME);
    Assert.assertEquals(DPN_ID_1, dpnId);
    // 4. fetch parent-interface corresponding to an interface
    Assert.assertEquals(PARENT_INTERFACE, interfaceManager.getParentRefNameForInterface(INTERFACE_NAME));
    // 5. get interface information
    assertEqualBeans(ExpectedInterfaceInfo.newVlanInterfaceInfo(), interfaceManager.getInterfaceInfo(INTERFACE_NAME));
    Assert.assertEquals(org.opendaylight.genius.interfacemanager.globals.IfmConstants.VXLAN_GROUPID_MIN + 1, interfaceManager.getLogicalTunnelSelectGroupId(1));
    // 6. Test bind ingress service
    BoundServices serviceInfo = InterfaceManagerTestUtil.buildServicesInfo("ELAN", NwConstants.ELAN_SERVICE_INDEX);
    interfaceManager.bindService(INTERFACE_NAME, ServiceModeIngress.class, serviceInfo);
    waitTillOperationCompletes("test bind ingress service api", coordinatorEventsWaiter, 1, asyncEventsWaiter);
    String lportDispatcherFlowRef = String.valueOf(dpnId) + NwConstants.FLOWID_SEPARATOR + NwConstants.LPORT_DISPATCHER_TABLE + NwConstants.FLOWID_SEPARATOR + INTERFACE_NAME + NwConstants.FLOWID_SEPARATOR + NwConstants.DEFAULT_SERVICE_INDEX;
    FlowKey lportDispatcherFlowKey = new FlowKey(new FlowId(lportDispatcherFlowRef));
    Node nodeDpn = InterfaceManagerTestUtil.buildInventoryDpnNode(dpnId);
    InstanceIdentifier<Flow> lportDispatcherFlowId = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class).child(Table.class, new TableKey(NwConstants.LPORT_DISPATCHER_TABLE)).child(Flow.class, lportDispatcherFlowKey).build();
    flowAssertTestUtils.assertFlowsInAnyOrder(ExpectedFlowEntries.newLportDispatcherFlow(), dataBroker.newReadOnlyTransaction().read(CONFIGURATION, lportDispatcherFlowId).checkedGet().get());
    // check whether service-binding state cache is populated
    assertEqualBeans(ExpectedBoundServiceState.newBoundServiceState(), FlowBasedServicesUtils.getBoundServicesState(dataBroker.newReadOnlyTransaction(), INTERFACE_NAME, ServiceModeIngress.class));
    // 7. test check whether service is bound on ingress
    Assert.assertTrue(interfaceManager.isServiceBoundOnInterfaceForIngress(NwConstants.ELAN_SERVICE_INDEX, INTERFACE_NAME));
    // 8. test unbind ingress service
    interfaceManager.unbindService(INTERFACE_NAME, ServiceModeIngress.class, serviceInfo);
    waitTillOperationCompletes("test unbind ingress service api", coordinatorEventsWaiter, 2, asyncEventsWaiter);
    Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(CONFIGURATION, lportDispatcherFlowId).get());
    // check service-state cache is cleaned up
    // 9. Test bind egress service
    short egressACLIndex = ServiceIndex.getIndex(NwConstants.EGRESS_ACL_SERVICE_NAME, NwConstants.EGRESS_ACL_SERVICE_INDEX);
    serviceInfo = InterfaceManagerTestUtil.buildServicesInfo("EGRESS_ACL", egressACLIndex);
    interfaceManager.bindService(INTERFACE_NAME, ServiceModeEgress.class, serviceInfo);
    waitTillOperationCompletes("test bind egress service api", coordinatorEventsWaiter, 1, asyncEventsWaiter);
    String egressDispatcherFlowRef = String.valueOf(dpnId) + NwConstants.FLOWID_SEPARATOR + NwConstants.EGRESS_LPORT_DISPATCHER_TABLE + NwConstants.FLOWID_SEPARATOR + INTERFACE_NAME + NwConstants.FLOWID_SEPARATOR + NwConstants.DEFAULT_EGRESS_SERVICE_INDEX;
    FlowKey egressDispatcherFlowKey = new FlowKey(new FlowId(egressDispatcherFlowRef));
    InstanceIdentifier<Flow> egressDispatcherFlowId = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class).child(Table.class, new TableKey(NwConstants.EGRESS_LPORT_DISPATCHER_TABLE)).child(Flow.class, egressDispatcherFlowKey).build();
    // FIXME the extend file getting generated had some import issues, will revist  later
    // assertEqualBeans(null,
    // dataBroker.newReadOnlyTransaction().read(CONFIGURATION, egressDispatcherFlowId).checkedGet().get());
    Assert.assertNotNull(dataBroker.newReadOnlyTransaction().read(CONFIGURATION, egressDispatcherFlowId).checkedGet().get());
    // 10. test check whether service is bound on egress
    Assert.assertTrue(interfaceManager.isServiceBoundOnInterfaceForEgress(NwConstants.EGRESS_ACL_SERVICE_INDEX, INTERFACE_NAME));
    // 11. Test unbinding of egress service
    interfaceManager.unbindService(INTERFACE_NAME, ServiceModeEgress.class, serviceInfo);
    waitTillOperationCompletes("test unbind egress service api", coordinatorEventsWaiter, 2, asyncEventsWaiter);
    Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(CONFIGURATION, egressDispatcherFlowId).get());
    // 12. Test fetching child interfaces of an interface
    // FIXME change the below assert once sorted augmentation fix lands
    assertEqualBeans(INTERFACE_NAME, interfaceManager.getChildInterfaces(PARENT_INTERFACE).get(0).getName());
    // 13. Test fetching interface-info from operational DS
    assertEqualBeans(ExpectedInterfaceInfo.newInterfaceInfo(1, INTERFACE_NAME, PARENT_INTERFACE, null), interfaceManager.getInterfaceInfoFromOperationalDataStore(INTERFACE_NAME));
    // 14. Test fetching of interface-info from oper DS, given interface-type
    assertEqualBeans(ExpectedInterfaceInfo.newInterfaceInfo(1, INTERFACE_NAME, INTERFACE_NAME, InterfaceInfo.InterfaceType.VLAN_INTERFACE), interfaceManager.getInterfaceInfoFromOperationalDataStore(INTERFACE_NAME, InterfaceInfo.InterfaceType.VLAN_INTERFACE));
    // 15.Test fetching of interface-info from cache
    assertEqualBeans(ExpectedInterfaceInfo.newInterfaceInfo(1, INTERFACE_NAME, PARENT_INTERFACE, null), interfaceManager.getInterfaceInfoFromOperationalDSCache(INTERFACE_NAME));
    // 16. Test creation of VLAN interface
    // FIXME Make IInterfaceManager truly async
    interfaceManager.createVLANInterface(INTERFACE_NAME_1, PARENT_INTERFACE_1, null, INTERFACE_NAME_1, IfL2vlan.L2vlanMode.Trunk);
    // waitTillOperationCompletes(coordinatorEventsWaiter, 1, asyncEventsWaiter);
    // assertEqualBeans(ExpectedInterfaceConfig.newVlanInterfaceConfig(INTERFACE_NAME_1, null),
    // dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, IfmUtil.buildId(
    // INTERFACE_NAME_1)).checkedGet().get());
    // 17. Update Parent Refs for VLAN interface
    // FIXME Make IInterfaceManager truly async
    // interfaceManager.updateInterfaceParentRef(INTERFACE_NAME_1, PARENT_INTERFACE_1);
    waitTillOperationCompletes("create vlan interface api", coordinatorEventsWaiter, 4, asyncEventsWaiter);
    assertEqualBeans(ExpectedInterfaceConfig.newVlanInterfaceConfig(INTERFACE_NAME_1, PARENT_INTERFACE_1), dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, IfmUtil.buildId(INTERFACE_NAME_1)).checkedGet().get());
    // 18. Test creation of external l2vlan interfaces
    // FIXME Make IInterfaceManager truly async
    interfaceManager.createVLANInterface(INTERFACE_NAME_2, PARENT_INTERFACE_2, null, INTERFACE_NAME_2, IfL2vlan.L2vlanMode.Trunk, true);
    // waitTillOperationCompletes(coordinatorEventsWaiter, 1, asyncEventsWaiter);
    // FIXME need to wait for https://git.opendaylight.org/gerrit/#/c/54811/ this to land
    // to do proper assertion
    // Assert.assertNotNull(dataBroker
    // .newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, IfmUtil
    // .buildId(INTERFACE_NAME_2)).checkedGet().get().getAugmentation(IfExternal.class));
    // 19. update parent-refs
    // interfaceManager.updateInterfaceParentRef(INTERFACE_NAME_2, PARENT_INTERFACE_2, true);
    waitTillOperationCompletes("create external vlan interface api", coordinatorEventsWaiter, 4, asyncEventsWaiter);
    Assert.assertEquals(PARENT_INTERFACE_2, dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, IfmUtil.buildId(INTERFACE_NAME_2)).checkedGet().get().getAugmentation(ParentRefs.class).getParentInterface());
    // 20. get list of vlan interfaces
    // FIXME need to wait for https://git.opendaylight.org/gerrit/#/c/54811/ this to land
    // to do proper assertion
    assertEqualBeans(3, interfaceManager.getVlanInterfaces().size());
    // 21. check if an interface is external interface
    Assert.assertTrue(interfaceManager.isExternalInterface(INTERFACE_NAME_2));
    // 22. check port name for an interface, given dpn-id and interface-name
    assertEqualBeans(PARENT_INTERFACE, interfaceManager.getPortNameForInterface(DPN_ID_1.toString(), PARENT_INTERFACE));
    // 23. check port name for an interface, given nodeconnectorid
    assertEqualBeans(PARENT_INTERFACE, interfaceManager.getPortNameForInterface(new NodeConnectorId("openflow:1:2"), PARENT_INTERFACE));
    // 24. get termination-points from cache
    Assert.assertNotNull(interfaceManager.getTerminationPointCache().get(INTERFACE_NAME));
    // 25. fetch termination point for interface
    assertEqualBeans(ExpectedTerminationPoint.newOvsdbTerminationPointAugmentation(), interfaceManager.getTerminationPointForInterface(INTERFACE_NAME));
    // 26. fetch ovsdb bridge corresponding to an interface
    assertEqualBeans(ExpectedOvsdbBridge.newOvsdbBridge(), interfaceManager.getOvsdbBridgeForInterface(INTERFACE_NAME));
    // 27. fetch ovsdb bridge corresponding to nodeIid
    assertEqualBeans(ExpectedOvsdbBridge.newOvsdbBridge(), interfaceManager.getOvsdbBridgeForNodeIid(OvsdbSouthboundTestUtil.createInstanceIdentifier("192.168.56.101", 6640, "s2")));
}
Also used : FlowKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) TableKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) ServiceModeIngress(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeIngress) FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) BigInteger(java.math.BigInteger)

Example 58 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project genius by opendaylight.

the class DirectTunnelUtils method getEgressActionInfosForInterface.

private List<ActionInfo> getEgressActionInfosForInterface(String interfaceName, long tunnelKey, int actionKeyStart) {
    DpnTepInterfaceInfo interfaceInfo = dpnTepStateCache.getTunnelFromCache(interfaceName);
    if (interfaceInfo == null) {
        LOG.error("Interface information not present in config DS for {}", interfaceName);
        return Collections.singletonList(new ActionDrop());
    }
    Optional<StateTunnelList> ifState;
    try {
        ifState = tunnelStateCache.get(tunnelStateCache.getStateTunnelListIdentifier(interfaceName));
    } catch (ReadFailedException e) {
        LOG.error("Interface information not present in oper DS for {} ", interfaceName, e);
        return Collections.singletonList(new ActionDrop());
    }
    if (ifState.isPresent()) {
        String tunnelType = ItmUtils.convertTunnelTypetoString(interfaceInfo.getTunnelType());
        return getEgressActionInfosForInterface(tunnelType, ifState.get().getPortNumber(), tunnelKey, actionKeyStart);
    }
    LOG.error("Interface information not present in oper DS for {}", interfaceName);
    return Collections.singletonList(new ActionDrop());
}
Also used : ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) StateTunnelList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList) DpnTepInterfaceInfo(org.opendaylight.genius.itm.utils.DpnTepInterfaceInfo) ActionDrop(org.opendaylight.genius.mdsalutil.actions.ActionDrop)

Example 59 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project genius by opendaylight.

the class OvsdbNodeListener method processBridgeUpdate.

private void processBridgeUpdate(OvsdbBridgeAugmentation ovsdbNewBridgeAugmentation) {
    String bridgeName = null;
    String strDpnId = null;
    OvsdbNodeAugmentation ovsdbNewNodeAugmentation = null;
    if (ovsdbNewBridgeAugmentation != null) {
        bridgeName = ovsdbNewBridgeAugmentation.getBridgeName().getValue();
        // Read DPID from OVSDBBridgeAugmentation
        strDpnId = ItmUtils.getStrDatapathId(ovsdbNewBridgeAugmentation);
        if (strDpnId == null || strDpnId.isEmpty()) {
            LOG.info("OvsdbBridgeAugmentation processBridgeUpdate: DPID for bridge {} is NULL.", bridgeName);
            return;
        }
        // TBD: Move this time taking operations into DataStoreJobCoordinator
        Node ovsdbNodeFromBridge = ItmUtils.getOvsdbNode(ovsdbNewBridgeAugmentation, dataBroker);
        // check for OVSDB node
        if (ovsdbNodeFromBridge != null) {
            ovsdbNewNodeAugmentation = ovsdbNodeFromBridge.getAugmentation(OvsdbNodeAugmentation.class);
        } else {
            LOG.error("processBridgeUpdate: Ovsdb Node could not be fetched from Oper DS for bridge {}.", bridgeName);
            return;
        }
    }
    if (ovsdbNewNodeAugmentation != null) {
        OvsdbTepInfo ovsdbTepInfo = getOvsdbTepInfo(ovsdbNewNodeAugmentation);
        if (ovsdbTepInfo == null) {
            LOG.trace("processBridgeUpdate: No Tep Info");
            return;
        }
        // store TEP info required parameters
        String newLocalIp = ovsdbTepInfo.getLocalIp();
        String tzName = ovsdbTepInfo.getTzName();
        String newBridgeName = ovsdbTepInfo.getBrName();
        boolean ofTunnel = ovsdbTepInfo.getOfTunnel();
        // check if Local IP is configured or not
        if (newLocalIp != null && !newLocalIp.isEmpty()) {
            // if it is br-int, then add TEP into Config DS
            if (newBridgeName.equals(bridgeName)) {
                LOG.trace("Ovs Node with bridge {} is configured with Local IP.", bridgeName);
                // if flag is OFF, then no need to add TEP into ITM config DS.
                if (tzName == null || tzName.equals(ITMConstants.DEFAULT_TRANSPORT_ZONE)) {
                    boolean defTzEnabled = itmConfig.isDefTzEnabled();
                    if (!defTzEnabled) {
                        LOG.info("TEP ({}) cannot be added into {} when def-tz-enabled flag is false.", newLocalIp, ITMConstants.DEFAULT_TRANSPORT_ZONE);
                        return;
                    }
                }
                LOG.trace("Local-IP: {}, TZ name: {}, Bridge Name: {}, Bridge DPID: {}," + "of-tunnel flag: {}", newLocalIp, tzName, newBridgeName, strDpnId, ofTunnel);
                // Enqueue 'add TEP into new TZ' operation into DataStoreJobCoordinator
                jobCoordinator.enqueueJob(newLocalIp, new OvsdbTepAddWorker(newLocalIp, strDpnId, tzName, ofTunnel, dataBroker));
            } else {
                LOG.trace("TEP ({}) would be added later when bridge {} gets added into Ovs Node.", newLocalIp, newBridgeName);
            }
        } else {
            LOG.trace("Ovs Node with bridge {} is not configured with Local IP. Nothing to do.", bridgeName);
        }
    }
}
Also used : OvsdbNodeAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) OvsdbTepInfo(org.opendaylight.genius.itm.commons.OvsdbTepInfo) OvsdbTepAddWorker(org.opendaylight.genius.itm.confighelpers.OvsdbTepAddWorker)

Example 60 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project genius by opendaylight.

the class TransportZoneListener method remove.

@Override
public void remove(@Nonnull TransportZone transportZone) {
    LOG.debug("Received Transport Zone Remove Event: {}", transportZone);
    boolean allowTunnelDeletion;
    // due to change in def-tz-tunnel-type, then allow def-tz tunnels deletion
    if (transportZone.getZoneName().equalsIgnoreCase(ITMConstants.DEFAULT_TRANSPORT_ZONE)) {
        // Get TunnelTypeBase object for tunnel-type configured in config file
        Class<? extends TunnelTypeBase> tunType = ItmUtils.getTunnelType(itmConfig.getDefTzTunnelType());
        if (!itmConfig.isDefTzEnabled() || !transportZone.getTunnelType().equals(tunType)) {
            allowTunnelDeletion = true;
        } else {
            // this is case when def-tz removal request is from Northbound.
            allowTunnelDeletion = false;
            LOG.error("Deletion of {} is an incorrect usage", ITMConstants.DEFAULT_TRANSPORT_ZONE);
        }
    } else {
        allowTunnelDeletion = true;
    }
    if (allowTunnelDeletion) {
        // TODO : DPList code can be refactor with new specific class
        // which implement TransportZoneValidator
        List<DPNTEPsInfo> opDpnList = createDPNTepInfo(transportZone);
        List<HwVtep> hwVtepList = createhWVteps(transportZone);
        LOG.trace("Delete: Invoking deleteTunnels in ItmManager with DpnList {}", opDpnList);
        if (!opDpnList.isEmpty() || !hwVtepList.isEmpty()) {
            LOG.trace("Delete: Invoking ItmManager with hwVtep List {} ", hwVtepList);
            jobCoordinator.enqueueJob(transportZone.getZoneName(), new ItmTepRemoveWorker(opDpnList, hwVtepList, transportZone, dataBroker, mdsalManager, itmInternalTunnelDeleteWorker, dpnTEPsInfoCache));
        }
    }
}
Also used : ItmTepRemoveWorker(org.opendaylight.genius.itm.confighelpers.ItmTepRemoveWorker) HwVtep(org.opendaylight.genius.itm.confighelpers.HwVtep) DPNTEPsInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo)

Aggregations

ArrayList (java.util.ArrayList)47 Test (org.junit.Test)46 BigInteger (java.math.BigInteger)29 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)23 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)23 ByteBuf (io.netty.buffer.ByteBuf)21 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)21 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)20 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)19 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)19 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)19 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)16 ExecutionException (java.util.concurrent.ExecutionException)16 Optional (com.google.common.base.Optional)15 List (java.util.List)15 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)14 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)14 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)14 InterfaceKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey)12 Vteps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.Vteps)12