Search in sources :

Example 66 with Interfaces

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces in project netvirt by opendaylight.

the class TunnelUnderlayNetworkChangeListener method handleTepIpChangeEvent.

private void handleTepIpChangeEvent(BigInteger dpId, String srcTepIp, String origUnderlayNetwork, String updatedUnderlayNetwork) {
    LOG.debug("Underlay network change for TEP ip {} from {} to {} DPN {}", srcTepIp, origUnderlayNetwork, updatedUnderlayNetwork, dpId);
    com.google.common.base.Optional<DpnToInterface> dpnToInterfaceOpt = policyServiceUtil.getUnderlayNetworkDpnToInterfaces(origUnderlayNetwork, dpId);
    if (!dpnToInterfaceOpt.isPresent()) {
        LOG.debug("No DpnToInterfaces found for underlay network {} DPN {}", origUnderlayNetwork, dpId);
        return;
    }
    DpnToInterface dpnToInterface = dpnToInterfaceOpt.get();
    List<TunnelInterface> tunnelInterfaces = dpnToInterface.getTunnelInterface();
    if (tunnelInterfaces == null || tunnelInterfaces.isEmpty()) {
        LOG.debug("No tunnel interfaces found for underlay network {} on DPN {}", origUnderlayNetwork, dpId);
        return;
    }
    policyServiceUtil.updateTunnelInterfacesForUnderlayNetwork(origUnderlayNetwork, dpId, tunnelInterfaces, false);
    policyServiceUtil.updateTunnelInterfacesForUnderlayNetwork(updatedUnderlayNetwork, dpId, tunnelInterfaces, true);
}
Also used : DpnToInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.DpnToInterface) TunnelInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.dpn.to._interface.TunnelInterface)

Example 67 with Interfaces

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces in project genius by opendaylight.

the class ItmTunnelAggregationHelper method initTunnelAggregationConfig.

private void initTunnelAggregationConfig(ItmConfig itmConfig) {
    // Load balancing of VxLAN feature is guarded by a global configuration option in the ITM,
    // only when the feature is enabled, the logical tunnel interfaces should be created.
    boolean tunnelAggregationConfigEnabled = false;
    List<TunnelAggregation> tunnelsConfig = itmConfig != null ? itmConfig.getTunnelAggregation() : null;
    if (tunnelsConfig != null) {
        for (TunnelAggregation tnlCfg : tunnelsConfig) {
            Class<? extends TunnelTypeBase> tunType = ItmUtils.getTunnelType(tnlCfg.getKey().getTunnelType());
            if (tunType.isAssignableFrom(TunnelTypeVxlan.class)) {
                tunnelAggregationConfigEnabled = tnlCfg.isEnabled();
                LOG.info("MULTIPLE_VxLAN_TUNNELS: tunnelAggregationEnabled {}", tunnelAggregationConfigEnabled);
                break;
            }
        }
    }
    tunnelAggregationEnabled = tunnelAggregationConfigEnabled;
}
Also used : TunnelAggregation(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.itm.config.TunnelAggregation)

Example 68 with Interfaces

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces in project genius by opendaylight.

the class TepDeleteDatastore method doExecute.

@Override
protected Object doExecute() {
    final DataBroker dataBroker = itmProvider.getDataBroker();
    InstanceIdentifier<TransportZones> itmConfigPath = InstanceIdentifier.builder(TransportZones.class).build();
    InstanceIdentifier<Interfaces> interfacesConfigPath = InstanceIdentifier.builder(Interfaces.class).build();
    final InstanceIdentifier<InterfacesState> ifStateOpPath = InstanceIdentifier.builder(InterfacesState.class).build();
    InstanceIdentifier<Nodes> frmConfigPath = InstanceIdentifier.builder(Nodes.class).build();
    List<InstanceIdentifier<T>> allConfigPaths = new ArrayList<>();
    allConfigPaths.add((InstanceIdentifier<T>) itmConfigPath);
    allConfigPaths.add((InstanceIdentifier<T>) interfacesConfigPath);
    allConfigPaths.add((InstanceIdentifier<T>) frmConfigPath);
    // allConfigPaths.add((InstanceIdentifier<T>) tunnelsConfigPath);
    ItmUtils.asyncBulkRemove(dataBroker, LogicalDatastoreType.CONFIGURATION, allConfigPaths, ItmUtils.DEFAULT_CALLBACK);
    List<InstanceIdentifier<T>> allOperationalPaths = new ArrayList<>();
    // allOperationalPaths.add((InstanceIdentifier<T>) tnStateOpPath);
    allOperationalPaths.add((InstanceIdentifier<T>) ifStateOpPath);
    ItmUtils.asyncBulkRemove(dataBroker, LogicalDatastoreType.OPERATIONAL, allOperationalPaths, ItmUtils.DEFAULT_CALLBACK);
    return null;
}
Also used : ArrayList(java.util.ArrayList) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) Interfaces(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) TransportZones(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones) InterfacesState(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState)

Example 69 with Interfaces

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces in project genius by opendaylight.

the class FlowBasedServicesUtils method installEgressDispatcherSplitHorizonFlow.

public static void installEgressDispatcherSplitHorizonFlow(BigInteger dpId, BoundServices boundService, String interfaceName, WriteTransaction writeTransaction, int interfaceTag, short currentServiceIndex, Interface iface) {
    // only install split horizon drop flows for external interfaces
    if (!isExternal(iface)) {
        return;
    }
    if (LOG.isDebugEnabled()) {
        LOG.debug("Installing split horizon drop flow for external interface {} on dpId {}", interfaceName, dpId);
    }
    // BigInteger.ONE is used for
    BigInteger shFlagSet = BigInteger.ONE;
    // checking the Split-Horizon
    // flag
    List<MatchInfoBase> shMatches = FlowBasedServicesUtils.getMatchInfoForEgressDispatcherTable(interfaceTag, currentServiceIndex);
    shMatches.add(new MatchMetadata(shFlagSet, MetaDataUtil.METADATA_MASK_SH_FLAG));
    List<InstructionInfo> shInstructions = new ArrayList<>();
    List<ActionInfo> actionsInfos = new ArrayList<>();
    actionsInfos.add(new ActionDrop());
    shInstructions.add(new InstructionApplyActions(actionsInfos));
    String flowRef = getSplitHorizonFlowRef(dpId, NwConstants.EGRESS_LPORT_DISPATCHER_TABLE, interfaceName, shFlagSet);
    String serviceRef = boundService.getServiceName();
    // This must be higher priority than the egress flow
    int splitHorizonFlowPriority = boundService.getServicePriority() + 1;
    StypeOpenflow stypeOpenFlow = boundService.getAugmentation(StypeOpenflow.class);
    Flow egressSplitHorizonFlow = MDSALUtil.buildFlow(NwConstants.EGRESS_LPORT_DISPATCHER_TABLE, flowRef, splitHorizonFlowPriority, serviceRef, 0, 0, stypeOpenFlow.getFlowCookie(), shMatches, shInstructions);
    installFlow(dpId, egressSplitHorizonFlow, writeTransaction);
}
Also used : MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) StypeOpenflow(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.StypeOpenflow) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) ActionDrop(org.opendaylight.genius.mdsalutil.actions.ActionDrop) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) BigInteger(java.math.BigInteger) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase)

Example 70 with Interfaces

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces in project genius by opendaylight.

the class InterfaceManagerConfigurationTest method newl2vlanInterfaceTests.

@Test
public void newl2vlanInterfaceTests() throws Exception {
    // 1. When
    // i) parent-interface specified in above vlan configuration comes in operational/ietf-interfaces-state
    OvsdbSouthboundTestUtil.createTerminationPoint(dataBroker, PARENT_INTERFACE, null, INTERFACE_NAME);
    InterfaceManagerTestUtil.createFlowCapableNodeConnector(dataBroker, PARENT_INTERFACE, null);
    // 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().setParentInterface(PARENT_INTERFACE).build();
    InterfaceManagerTestUtil.putInterfaceConfig(dataBroker, INTERFACE_NAME, parentRefs, L2vlan.class);
    InterfaceManagerTestUtil.waitTillOperationCompletes("create interface configuration", coordinatorEventsWaiter, 11, 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(PARENT_INTERFACE), new InterfaceChildEntryKey(INTERFACE_NAME));
    assertEqualBeans(ExpectedInterfaceChildEntry.interfaceChildEntry(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(INTERFACE_NAME)).checkedGet().get();
    assertEqualBeans(ExpectedInterfaceState.newInterfaceState(ifaceState.getIfIndex(), 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(INTERFACE_NAME, dataBroker.newReadOnlyTransaction()
                .read(OPERATIONAL, ifIndexInterfaceInstanceIdentifier).checkedGet().get().getInterfaceName());*/
    // c) check expected flow entries were created in Interface Ingress
    // Table
    BigInteger dpnId = BigInteger.valueOf(1);
    String ingressFlowRef = FlowBasedServicesUtils.getFlowRef(VLAN_INTERFACE_INGRESS_TABLE, dpnId, INTERFACE_NAME);
    FlowKey ingressFlowKey = new FlowKey(new FlowId(ingressFlowRef));
    Node nodeDpn = InterfaceManagerTestUtil.buildInventoryDpnNode(dpnId);
    InstanceIdentifier<Flow> ingressFlowInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class).child(Table.class, new TableKey(VLAN_INTERFACE_INGRESS_TABLE)).child(Flow.class, ingressFlowKey).build();
    flowAssertTestUtils.assertFlowsInAnyOrder(ExpectedFlowEntries.newIngressFlow(), dataBroker.newReadOnlyTransaction().read(CONFIGURATION, ingressFlowInstanceId).checkedGet().get());
    // d) check if default egress service is bound on the interface
    InstanceIdentifier<BoundServices> boundServicesInstanceIdentifier = InstanceIdentifier.builder(ServiceBindings.class).child(ServicesInfo.class, new ServicesInfoKey(INTERFACE_NAME, ServiceModeEgress.class)).child(BoundServices.class, new BoundServicesKey(DEFAULT_EGRESS_SERVICE_INDEX)).build();
    assertEqualBeans(ExpectedServicesInfo.newboundService(), dataBroker.newReadOnlyTransaction().read(CONFIGURATION, boundServicesInstanceIdentifier).checkedGet().get());
    // Test all RPCs related to vlan-interfaces
    checkVlanRpcs();
    // Test all APIs exposed by interface-manager
    checkVlanApis();
    // Update config test
    // i) vlan interface admin-state updated
    InterfaceManagerTestUtil.updateInterfaceAdminState(dataBroker, INTERFACE_NAME, false);
    InterfaceManagerTestUtil.waitTillOperationCompletes("disable interface admin state", coordinatorEventsWaiter, 1, asyncEventsWaiter);
    // Then
    // a) check if operational/ietf-interfaces-state is updated for vlan interface
    ifaceState = dataBroker.newReadOnlyTransaction().read(OPERATIONAL, IfmUtil.buildStateInterfaceId(INTERFACE_NAME)).checkedGet().get();
    assertEqualBeans(ExpectedInterfaceState.newInterfaceState(ifaceState.getIfIndex(), INTERFACE_NAME, Interface.OperStatus.Down, L2vlan.class, DPN_ID_1.toString(), ifaceState.getStatistics().getDiscontinuityTime()), ifaceState);
    // Restore the opState back to UP for proceeding with further tests
    InterfaceManagerTestUtil.updateInterfaceAdminState(dataBroker, INTERFACE_NAME, true);
    InterfaceManagerTestUtil.waitTillOperationCompletes("enable interface admin state", coordinatorEventsWaiter, 1, asyncEventsWaiter);
    // state modification tests
    // 1. Make the operational state of port as DOWN
    InterfaceManagerTestUtil.updateFlowCapableNodeConnectorState(dataBroker, PARENT_INTERFACE, L2vlan.class, false);
    waitTillOperationCompletes("disable interface op state", coordinatorEventsWaiter, 2, asyncEventsWaiter);
    ifaceState = dataBroker.newReadOnlyTransaction().read(OPERATIONAL, IfmUtil.buildStateInterfaceId(INTERFACE_NAME)).checkedGet().get();
    // Verify if operational/ietf-interface-state is marked down
    assertEqualBeans(ExpectedInterfaceState.newInterfaceState(ifaceState.getIfIndex(), INTERFACE_NAME, Interface.OperStatus.Down, L2vlan.class, DPN_ID_1.toString(), ifaceState.getStatistics().getDiscontinuityTime()), ifaceState);
    // 4. Delete the southbound OF port
    InterfaceManagerTestUtil.removeFlowCapableNodeConnectorState(dataBroker, L2vlan.class);
    waitTillOperationCompletes("remove flow capable node connector", coordinatorEventsWaiter, 5, asyncEventsWaiter);
    // Verify if interfaces are deleted from oper/ietf-interfaces-state
    Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(OPERATIONAL, IfmUtil.buildStateInterfaceId(PARENT_INTERFACE)).get());
    Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(OPERATIONAL, IfmUtil.buildStateInterfaceId(INTERFACE_NAME)).get());
    // 3. Re-create the OF port to proceeed with vlan-member tests
    InterfaceManagerTestUtil.createFlowCapableNodeConnector(dataBroker, PARENT_INTERFACE, null);
    waitTillOperationCompletes("remove flow capable node connector", coordinatorEventsWaiter, 7, asyncEventsWaiter);
    testVlanMemberInterface();
    // Delete test
    // iii) vlan interface is deleted from config/ietf-interfaces
    InterfaceManagerTestUtil.deleteInterfaceConfig(dataBroker, INTERFACE_NAME);
    InterfaceManagerTestUtil.waitTillOperationCompletes("delete interface configuration", coordinatorEventsWaiter, 6, asyncEventsWaiter);
    // 3. Then
    // a) check expected interface-child entry mapping in
    // odl-interface-meta/config/interface-child-info is deleted
    // TODO Later use nicer abstraction for DB access here.. see
    // ElanServiceTest
    Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(CONFIGURATION, interfaceChildEntryInstanceIdentifier).get());
    // Then
    // a) check if operational/ietf-interfaces-state is deleted for the vlan
    // interface
    Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(OPERATIONAL, IfmUtil.buildStateInterfaceId(INTERFACE_NAME)).get());
// b) check if lport-tag to interface mapping is deleted
/*Assert.assertEquals(Optional.absent(),
                dataBroker.newReadOnlyTransaction().read(OPERATIONAL, ifIndexInterfaceInstanceIdentifier).get());*/
}
Also used : 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) ServiceModeEgress(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeEgress) InterfaceChildEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntryKey) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) ParentRefs(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs) ServicesInfoKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfoKey) InterfaceParentEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntryKey) 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) 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) TableKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) ParentRefsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefsBuilder) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) BoundServicesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesKey) BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) ServiceBindings(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceBindings) 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) BigInteger(java.math.BigInteger) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)26 BigInteger (java.math.BigInteger)24 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)23 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)14 Subnetmap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)10 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)9 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)7 HashSet (java.util.HashSet)7 ExecutionException (java.util.concurrent.ExecutionException)7 HashMap (java.util.HashMap)4 List (java.util.List)4 Test (org.junit.Test)4 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)4 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)4 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)4 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)4 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)4 RouterPorts (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.RouterPorts)4 Ports (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.Ports)4 InternalToExternalPortMap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.ports.InternalToExternalPortMap)4