Search in sources :

Example 41 with NodeConnectorId

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

the class SalToOfOutputActionCase method process.

@Nonnull
@Override
public Optional<Action> process(@Nonnull final OutputActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
    final OutputAction outputAction = source.getOutputAction();
    final OutputActionBuilder outputBuilder = new OutputActionBuilder();
    if (outputAction.getMaxLength() != null) {
        outputBuilder.setMaxLength(outputAction.getMaxLength());
    } else {
        outputBuilder.setMaxLength(0);
    }
    final OpenflowVersion version = OpenflowVersion.get(data.getVersion());
    final String nodeConnectorId = outputAction.getOutputNodeConnector().getValue();
    final Long portNumber = InventoryDataServiceUtil.portNumberfromNodeConnectorId(version, nodeConnectorId);
    if (OpenflowPortsUtil.checkPortValidity(version, portNumber)) {
        outputBuilder.setPort(new PortNumber(portNumber));
    } else {
        LOG.error("Invalid Port specified {} for Output Action for OF version: {}", portNumber, version);
    }
    return Optional.of(new ActionBuilder().setActionChoice(new OutputActionCaseBuilder().setOutputAction(outputBuilder.build()).build()).build());
}
Also used : OutputActionCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder) OutputActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) OpenflowVersion(org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion) OutputAction(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputAction) OutputActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) Nonnull(javax.annotation.Nonnull)

Example 42 with NodeConnectorId

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

the class MatchResponseConvertorTest method checkDefault.

private static void checkDefault(final MatchBuilder builder) {
    EthernetMatch ethMatch = builder.getEthernetMatch();
    assertEquals(MAC_SRC, ethMatch.getEthernetSource().getAddress());
    assertEquals(null, ethMatch.getEthernetSource().getMask());
    assertEquals(MAC_DST, ethMatch.getEthernetDestination().getAddress());
    assertEquals(null, ethMatch.getEthernetDestination().getMask());
    assertEquals(ETHTYPE_IPV4, ethMatch.getEthernetType().getType().getValue().intValue());
    NodeConnectorId inPort = builder.getInPort();
    assertEquals(URI_IN_PORT, inPort.getValue());
}
Also used : EthernetMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)

Example 43 with NodeConnectorId

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

the class FlowBasedEgressServicesStateBindHelper method bindServicesOnInterface.

@Override
public void bindServicesOnInterface(WriteTransaction tx, List<BoundServices> allServices, Interface ifState) {
    LOG.info("bind all egress services for interface: {}", 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);
    org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface iface = interfaceManagerCommonUtils.getInterfaceFromConfigDS(ifState.getName());
    FlowBasedServicesUtils.installEgressDispatcherFlows(dpId, highestPriority, ifState.getName(), tx, ifState.getIfIndex(), NwConstants.DEFAULT_SERVICE_INDEX, nextServiceIndex, iface);
    BoundServices prev = null;
    for (BoundServices boundService : allServices) {
        if (prev != null) {
            FlowBasedServicesUtils.installEgressDispatcherFlows(dpId, prev, ifState.getName(), tx, ifState.getIfIndex(), prev.getServicePriority(), boundService.getServicePriority(), iface);
        }
        prev = boundService;
    }
    if (prev != null) {
        FlowBasedServicesUtils.installEgressDispatcherFlows(dpId, prev, ifState.getName(), tx, ifState.getIfIndex(), prev.getServicePriority(), (short) (prev.getServicePriority() + 1), iface);
    }
}
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 44 with NodeConnectorId

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

the class FlowBasedServicesUtils method buildBoundServicesState.

public static BoundServicesState buildBoundServicesState(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface interfaceState, Class<? extends ServiceModeBase> serviceMode) {
    NodeConnectorId nodeConnectorId = IfmUtil.getNodeConnectorIdFromInterface(interfaceState);
    BigInteger dpId = IfmUtil.getDpnFromNodeConnectorId(nodeConnectorId);
    long portNo = IfmUtil.getPortNumberFromNodeConnectorId(nodeConnectorId);
    BoundServicesStateKey boundServicesStateKey = new BoundServicesStateKey(interfaceState.getName(), serviceMode);
    return new BoundServicesStateBuilder().setDpid(dpId).setIfIndex(interfaceState.getIfIndex()).setInterfaceName(interfaceState.getName()).setInterfaceType(interfaceState.getType()).setPortNo(portNo).setServiceMode(serviceMode).setKey(boundServicesStateKey).build();
}
Also used : BoundServicesStateKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.bound.services.state.list.BoundServicesStateKey) BoundServicesStateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.bound.services.state.list.BoundServicesStateBuilder) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) BigInteger(java.math.BigInteger)

Example 45 with NodeConnectorId

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

the class FlowBasedServicesUtils method getDpnIdFromInterface.

@Nullable
public static BigInteger getDpnIdFromInterface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState) {
    if (ifState != null) {
        List<String> ofportIds = ifState.getLowerLayerIf();
        NodeConnectorId nodeConnectorId = new NodeConnectorId(ofportIds.get(0));
        return IfmUtil.getDpnFromNodeConnectorId(nodeConnectorId);
    }
    return null;
}
Also used : NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) Nullable(javax.annotation.Nullable)

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