Search in sources :

Example 96 with NodeConnectorId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project genius by opendaylight.

the class DirectTunnelUtils method isNodeConnectorPresent.

public boolean isNodeConnectorPresent(NodeConnectorId nodeConnectorId) throws ReadFailedException {
    NodeId nodeId = getNodeIdFromNodeConnectorId(nodeConnectorId);
    InstanceIdentifier<NodeConnector> ncIdentifier = InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, new NodeKey(nodeId)).child(NodeConnector.class, new NodeConnectorKey(nodeConnectorId)).build();
    return SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, ncIdentifier).isPresent();
}
Also used : NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) NodeConnectorKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)

Example 97 with NodeConnectorId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project genius by opendaylight.

the class FlowBasedIngressServicesStateBindHelper method bindServiceOnVlan.

private void bindServiceOnVlan(WriteTransaction tx, List<BoundServices> allServices, Interface ifState) {
    LOG.info("bind all ingress services for vlan port: {}", ifState.getName());
    NodeConnectorId nodeConnectorId = FlowBasedServicesUtils.getNodeConnectorIdFromInterface(ifState);
    BigInteger dpId = IfmUtil.getDpnFromNodeConnectorId(nodeConnectorId);
    allServices.sort(Comparator.comparing(BoundServices::getServicePriority));
    BoundServices highestPriority = allServices.remove(0);
    short nextServiceIndex = (short) (allServices.size() > 0 ? allServices.get(0).getServicePriority() : highestPriority.getServicePriority() + 1);
    FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, highestPriority, ifState.getName(), tx, ifState.getIfIndex(), NwConstants.DEFAULT_SERVICE_INDEX, nextServiceIndex);
    BoundServices prev = null;
    for (BoundServices boundService : allServices) {
        if (prev != null) {
            FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, prev, ifState.getName(), tx, ifState.getIfIndex(), prev.getServicePriority(), boundService.getServicePriority());
        }
        prev = boundService;
    }
    if (prev != null) {
        FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, prev, ifState.getName(), tx, ifState.getIfIndex(), prev.getServicePriority(), (short) (prev.getServicePriority() + 1));
    }
}
Also used : BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) BigInteger(java.math.BigInteger)

Example 98 with NodeConnectorId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project genius by opendaylight.

the class FlowBasedIngressServicesStateBindHelper method bindServiceOnTunnel.

private void bindServiceOnTunnel(WriteTransaction tx, List<BoundServices> allServices, Interface ifState) {
    org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface iface = interfaceManagerCommonUtils.getInterfaceFromConfigDS(ifState.getName());
    NodeConnectorId nodeConnectorId = FlowBasedServicesUtils.getNodeConnectorIdFromInterface(ifState);
    long portNo = IfmUtil.getPortNumberFromNodeConnectorId(nodeConnectorId);
    BigInteger dpId = IfmUtil.getDpnFromNodeConnectorId(nodeConnectorId);
    List<MatchInfo> matches = FlowBasedServicesUtils.getMatchInfoForTunnelPortAtIngressTable(dpId, portNo);
    BoundServices highestPriorityBoundService = FlowBasedServicesUtils.getHighestPriorityService(allServices);
    FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface, highestPriorityBoundService, tx, matches, ifState.getIfIndex(), NwConstants.VLAN_INTERFACE_INGRESS_TABLE);
    for (BoundServices boundService : allServices) {
        if (!boundService.equals(highestPriorityBoundService)) {
            FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, boundService, ifState.getName(), tx, ifState.getIfIndex(), boundService.getServicePriority(), (short) (boundService.getServicePriority() + 1));
        }
    }
}
Also used : NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) BigInteger(java.math.BigInteger)

Example 99 with NodeConnectorId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project genius by opendaylight.

the class IfmUtil method getEgressActionInfosForInterface.

/**
 * Returns a list of Actions to be taken when sending a packet over an
 * interface.
 *
 * @param interfaceName
 *            name of the interface
 * @param tunnelKey
 *            Optional.
 * @param actionKeyStart
 *            action key
 * @param interfaceUtils
 *            InterfaceManagerCommonUtils
 * @return list of actions
 */
public static List<ActionInfo> getEgressActionInfosForInterface(String interfaceName, Long tunnelKey, int actionKeyStart, InterfaceManagerCommonUtils interfaceUtils, Boolean isDefaultEgress) {
    Interface interfaceInfo = interfaceUtils.getInterfaceFromConfigDS(new InterfaceKey(interfaceName));
    if (interfaceInfo == null) {
        throw new NullPointerException("Interface information not present in config DS for " + interfaceName);
    }
    org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = interfaceUtils.getInterfaceState(interfaceName);
    if (ifState == null) {
        throw new NullPointerException("Interface information not present in oper DS for " + interfaceName);
    }
    String lowerLayerIf = ifState.getLowerLayerIf().get(0);
    NodeConnectorId nodeConnectorId = new NodeConnectorId(lowerLayerIf);
    String portNo = IfmUtil.getPortNoFromNodeConnectorId(nodeConnectorId);
    InterfaceInfo.InterfaceType ifaceType = getInterfaceType(interfaceInfo);
    return getEgressActionInfosForInterface(interfaceInfo, portNo, ifaceType, tunnelKey, actionKeyStart, isDefaultEgress, ifState.getIfIndex(), 0);
}
Also used : Collections(java.util.Collections) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) VlanInterfaceInfo(org.opendaylight.genius.interfacemanager.globals.VlanInterfaceInfo) InterfaceInfo(org.opendaylight.genius.interfacemanager.globals.InterfaceInfo) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)

Example 100 with NodeConnectorId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project genius by opendaylight.

the class InterfacemgrProvider method getInterfaceInfo.

@Override
public InterfaceInfo getInterfaceInfo(String interfaceName) {
    org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = interfaceManagerCommonUtils.getInterfaceState(interfaceName);
    if (ifState == null) {
        LOG.debug("Interface {} is not present", interfaceName);
        return null;
    }
    Interface intf = interfaceManagerCommonUtils.getInterfaceFromConfigDS(new InterfaceKey(interfaceName));
    if (intf == null) {
        LOG.error("Interface {} doesn't exist in config datastore", interfaceName);
        return null;
    }
    NodeConnectorId ncId = FlowBasedServicesUtils.getNodeConnectorIdFromInterface(intf.getName(), interfaceManagerCommonUtils);
    InterfaceInfo.InterfaceType interfaceType = IfmUtil.getInterfaceType(intf);
    InterfaceInfo interfaceInfo = new InterfaceInfo(interfaceName);
    BigInteger dpId = org.opendaylight.genius.interfacemanager.globals.IfmConstants.INVALID_DPID;
    Integer portNo = org.opendaylight.genius.interfacemanager.globals.IfmConstants.INVALID_PORT_NO;
    if (ncId != null) {
        dpId = IfmUtil.getDpnFromNodeConnectorId(ncId);
        portNo = Integer.parseInt(IfmUtil.getPortNoFromNodeConnectorId(ncId));
    }
    if (interfaceType == InterfaceInfo.InterfaceType.VLAN_INTERFACE) {
        interfaceInfo = IfmUtil.getVlanInterfaceInfo(intf, dpId);
    } else if (interfaceType == InterfaceInfo.InterfaceType.UNKNOWN_INTERFACE) {
        LOG.error("Type of Interface {} is unknown", interfaceName);
        return null;
    }
    interfaceInfo.setDpId(dpId);
    interfaceInfo.setPortNo(portNo);
    interfaceInfo.setAdminState(intf.isEnabled() ? InterfaceAdminState.ENABLED : InterfaceAdminState.DISABLED);
    interfaceInfo.setInterfaceName(interfaceName);
    Integer lportTag = ifState.getIfIndex();
    interfaceInfo.setInterfaceTag(lportTag);
    interfaceInfo.setInterfaceType(interfaceType);
    interfaceInfo.setGroupId(IfmUtil.getGroupId(lportTag, interfaceType));
    interfaceInfo.setOpState(InterfaceInfo.InterfaceOpState.fromModel(ifState.getOperStatus()));
    PhysAddress phyAddress = ifState.getPhysAddress();
    if (phyAddress != null) {
        interfaceInfo.setMacAddress(ifState.getPhysAddress().getValue());
    }
    return interfaceInfo;
}
Also used : Collections(java.util.Collections) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) BigInteger(java.math.BigInteger) BigInteger(java.math.BigInteger) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) InterfaceInfo(org.opendaylight.genius.interfacemanager.globals.InterfaceInfo) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface) PhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)

Aggregations

NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)86 BigInteger (java.math.BigInteger)31 NodeConnectorKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)19 NodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector)17 NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)16 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)15 FlowCapableNodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector)12 Test (org.junit.Test)11 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)11 ArrayList (java.util.ArrayList)10 Collections (java.util.Collections)10 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)9 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)9 PhysAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)8 NodeConnectorStatisticsAndPortNumberMap (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap)8 NodeConnectorRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef)7 MultipartReply (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply)7 List (java.util.List)6 ExecutionException (java.util.concurrent.ExecutionException)6 Xid (org.opendaylight.openflowplugin.api.openflow.device.Xid)5