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());
}
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());
}
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);
}
}
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();
}
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;
}
Aggregations