• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ExtensionTreatment类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.onosproject.net.flow.instructions.ExtensionTreatment的典型用法代码示例。如果您正苦于以下问题:Java ExtensionTreatment类的具体用法?Java ExtensionTreatment怎么用?Java ExtensionTreatment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ExtensionTreatment类属于org.onosproject.net.flow.instructions包,在下文中一共展示了ExtensionTreatment类的36个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: mapAction

点赞 3

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
@Override
public ExtensionTreatment mapAction(OFAction action) throws UnsupportedOperationException {
    if (action.getType().equals(OFActionType.SET_FIELD)) {
        OFActionSetField setFieldAction = (OFActionSetField) action;
        OFOxm<?> oxm = setFieldAction.getField();
        switch (oxm.getMatchField().id) {
            case VLAN_VID:
                OFOxmVlanVid vlanVid = (OFOxmVlanVid) oxm;
                return new OfdpaSetVlanVid(VlanId.vlanId(vlanVid.getValue().getRawVid()));
            default:
                throw new UnsupportedOperationException(
                        "Driver does not support extension type " + oxm.getMatchField().id);
        }
    }
    throw new UnsupportedOperationException(
            "Unexpected OFAction: " + action.toString());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:18,
代码来源:OfdpaExtensionTreatmentInterpreter.java

示例2: buildNiciraExtenstion

点赞 3

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
/**
 * Builds Nicira extension for tagging remoteIp of vxlan.
 *
 * @param id Device Id of vxlan source device
 * @param hostIp Remote Ip of vxlan destination device
 * @return NiciraExtension Treatment
 */
public ExtensionTreatment buildNiciraExtenstion(DeviceId id, Ip4Address hostIp) {
    Driver driver = driverService.getDriver(id);
    DriverHandler driverHandler = new DefaultDriverHandler(new DefaultDriverData(driver, id));
    ExtensionTreatmentResolver resolver = driverHandler.behaviour(ExtensionTreatmentResolver.class);

    ExtensionTreatment extensionInstruction =
            resolver.getExtensionInstruction(
                    ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type());

    try {
        extensionInstruction.setPropertyValue(TUNNEL_DESTINATION, hostIp);
    } catch (ExtensionPropertyException e) {
        log.error("Error setting Nicira extension setting {}", e);
    }

    return extensionInstruction;
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:25,
代码来源:OpenstackRoutingRulePopulator.java

示例3: buildNiciraExtenstion

点赞 3

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
private ExtensionTreatment buildNiciraExtenstion(DeviceId id, Ip4Address hostIp) {
    Driver driver = driverService.getDriver(id);
    DriverHandler driverHandler = new DefaultDriverHandler(new DefaultDriverData(driver, id));
    ExtensionTreatmentResolver resolver = driverHandler.behaviour(ExtensionTreatmentResolver.class);

    ExtensionTreatment extensionInstruction =
            resolver.getExtensionInstruction(
                    ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type());

    try {
        extensionInstruction.setPropertyValue(TUNNEL_DST, hostIp);
    } catch (ExtensionPropertyException e) {
        log.error("Error setting Nicira extension setting {}", e);
    }

    return  extensionInstruction;
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:18,
代码来源:OpenstackSwitchingRulePopulator.java

示例4: decodeExtension

点赞 3

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
/**
 * Decodes a extension instruction.
 *
 * @return extension treatment
 */
private Instruction decodeExtension() {
    ObjectNode node = (ObjectNode) json.get(InstructionCodec.EXTENSION);
    if (node != null) {
        DeviceId deviceId = getDeviceId();

        ServiceDirectory serviceDirectory = new DefaultServiceDirectory();
        DeviceService deviceService = serviceDirectory.get(DeviceService.class);
        Device device = deviceService.getDevice(deviceId);

        if (device.is(ExtensionTreatmentCodec.class)) {
            ExtensionTreatmentCodec treatmentCodec = device.as(ExtensionTreatmentCodec.class);
            ExtensionTreatment treatment = treatmentCodec.decode(node, null);
            return Instructions.extension(treatment, deviceId);
        } else {
            log.warn("There is no codec to decode extension for device {}", deviceId.toString());
        }
    }
    return null;
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:25,
代码来源:DecodeInstructionCodecHelper.java

示例5: read

点赞 3

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
@Override
public Instructions.ExtensionInstructionWrapper read(Kryo kryo, Input input,
                                                     Class<Instructions.ExtensionInstructionWrapper> type) {
    ExtensionTreatmentType exType = (ExtensionTreatmentType) kryo.readClassAndObject(input);
    DeviceId deviceId = (DeviceId) kryo.readClassAndObject(input);

    DriverService driverService = DefaultServiceDirectory.getService(DriverService.class);
    DriverHandler handler = new DefaultDriverHandler(
            new DefaultDriverData(driverService.getDriver(deviceId), deviceId));

    ExtensionTreatmentResolver resolver = handler.behaviour(ExtensionTreatmentResolver.class);
    ExtensionTreatment instruction = resolver.getExtensionInstruction(exType);

    byte[] bytes = (byte[]) kryo.readClassAndObject(input);

    instruction.deserialize(bytes);

    return Instructions.extension(instruction, deviceId);
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:20,
代码来源:ExtensionInstructionSerializer.java

示例6: tunnelDstTreatment

点赞 3

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
protected ExtensionTreatment tunnelDstTreatment(DeviceId deviceId, Ip4Address remoteIp) {
    Device device = deviceService.getDevice(deviceId);
    if (device != null && !device.is(ExtensionTreatmentResolver.class)) {
        log.error("The extension treatment is not supported");
        return null;
    }

    ExtensionTreatmentResolver resolver = device.as(ExtensionTreatmentResolver.class);
    ExtensionTreatment treatment = resolver.getExtensionInstruction(NICIRA_SET_TUNNEL_DST.type());
    try {
        treatment.setPropertyValue(PROPERTY_TUNNEL_DST, remoteIp);
        return treatment;
    } catch (ExtensionPropertyException e) {
        log.warn("Failed to get tunnelDst extension treatment for {}", deviceId);
        return null;
    }
}
 

开发者ID:opencord,
项目名称:vtn,
代码行数:18,
代码来源:AbstractInstanceHandler.java

示例7: renderExtensionInstruction

点赞 3

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
@Test
public void renderExtensionInstruction() {
    title("renderExtensionInstruction");

    ExtensionTreatment extn = new Ofdpa3SetMplsType((short) 32);
    DeviceId devid = deviceId(DEV_OF_204);

    instr = Instructions.extension(extn, devid);
    string = instr.toString();
    render = handler.renderInstructionForDisplay(instr);

    print(string);
    print(render);

    assertEquals("unexpected toString", EXT_FULL_STR, string);
    assertEquals("unexpected short string", EXT_NO_DPID, render);
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:18,
代码来源:FlowViewMessageHandlerTest.java

示例8: getExtensionInstruction

点赞 3

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
@Override
public ExtensionTreatment getExtensionInstruction(ExtensionTreatmentType type) {
    if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_MPLS_TYPE.type())) {
        return new Ofdpa3SetMplsType();
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_OVID.type())) {
        return new Ofdpa3SetOvid();
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_MPLS_L2_PORT.type())) {
        return new Ofdpa3SetMplsL2Port();
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_QOS_INDEX.type())) {
        return new Ofdpa3SetQosIndex();
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_PUSH_L2_HEADER.type())) {
        return new Ofdpa3PushL2Header();
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_PUSH_CW.type())) {
        return new Ofdpa3PushCw();
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_POP_L2_HEADER.type())) {
        return new Ofdpa3PopL2Header();
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_POP_CW.type())) {
        return new Ofdpa3PopCw();
    }
    throw new UnsupportedOperationException(NOT_SUPPORTED_MESSAGE + type.toString());
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:22,
代码来源:Ofdpa3ExtensionTreatmentInterpreter.java

示例9: getChannelAttenuation

点赞 3

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
/**
 * Gets specified channel attenuation.
 *
 * @param portNum the port number
 * @param och channel signal
 * @return atteuation in 0.01 dB
 */
private Long getChannelAttenuation(PortNumber portNum, OchSignal och) {
    FlowEntry flowEntry = findFlow(portNum, och);
    if (flowEntry == null) {
        return null;
    }
    List<Instruction> instructions = flowEntry.treatment().allInstructions();
    for (Instruction ins : instructions) {
        if (ins.type() != Instruction.Type.EXTENSION) {
            continue;
        }
        ExtensionTreatment ext = ((Instructions.ExtensionInstructionWrapper) ins).extensionInstruction();
        if (ext.type() == ExtensionTreatmentType.ExtensionTreatmentTypes.OPLINK_ATTENUATION.type()) {
            return (long) ((OplinkAttenuation) ext).getAttenuation();
        }
    }
    return null;
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:25,
代码来源:OplinkPowerConfigUtil.java

示例10: setChannelAttenuation

点赞 3

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
/**
 * Sets specified channle attenuation.
 *
 * @param portNum the port number
 * @param och channel signal
 * @param power attenuation in 0.01 dB
 */
private void setChannelAttenuation(PortNumber portNum, OchSignal och, long power) {
    FlowEntry flowEntry = findFlow(portNum, och);
    if (flowEntry == null) {
        log.warn("Target channel power not set");
        return;
    }
    final DriverHandler handler = behaviour.handler();
    for (Instruction ins : flowEntry.treatment().allInstructions()) {
        if (ins.type() != Instruction.Type.EXTENSION) {
            continue;
        }
        ExtensionTreatment ext = ((Instructions.ExtensionInstructionWrapper) ins).extensionInstruction();
        if (ext.type() == ExtensionTreatmentType.ExtensionTreatmentTypes.OPLINK_ATTENUATION.type()) {
            ((OplinkAttenuation) ext).setAttenuation((int) power);
            FlowRuleService service = handler.get(FlowRuleService.class);
            service.applyFlowRules(flowEntry);
            return;
        }
    }
    addAttenuation(flowEntry, power);
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:29,
代码来源:OplinkPowerConfigUtil.java

示例11: buildExtension

点赞 3

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
/**
 * Returns tunnel destination extension treatment object.
 *
 * @param deviceService driver service
 * @param deviceId device id to apply this treatment
 * @param remoteIp tunnel destination ip address
 * @return extension treatment
 */
public static ExtensionTreatment buildExtension(DeviceService deviceService,
                                                DeviceId deviceId,
                                                Ip4Address remoteIp) {
    Device device = deviceService.getDevice(deviceId);
    if (device != null && !device.is(ExtensionTreatmentResolver.class)) {
        log.error("The extension treatment is not supported");
        return null;
    }

    if (device == null) {
        return null;
    }

    ExtensionTreatmentResolver resolver = device.as(ExtensionTreatmentResolver.class);
    ExtensionTreatment treatment = resolver.getExtensionInstruction(NICIRA_SET_TUNNEL_DST.type());
    try {
        treatment.setPropertyValue(TUNNEL_DST, remoteIp);
        return treatment;
    } catch (ExtensionPropertyException e) {
        log.warn("Failed to get tunnelDst extension treatment for {}", deviceId);
        return null;
    }
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:32,
代码来源:RulePopulatorUtil.java

示例12: buildNiciraExtenstion

点赞 3

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
/**
 * Builds Nicira extension for tagging remoteIp of vxlan.
 *
 * @param id device id of vxlan source device
 * @param hostIp remote ip of vxlan destination device
 * @return NiciraExtension Treatment
 */
private ExtensionTreatment buildNiciraExtenstion(DeviceId id, Ip4Address hostIp) {
    Driver driver = driverService.getDriver(id);
    DriverHandler driverHandler = new DefaultDriverHandler(new DefaultDriverData(driver, id));
    ExtensionTreatmentResolver resolver = driverHandler.behaviour(ExtensionTreatmentResolver.class);

    ExtensionTreatment extensionInstruction =
            resolver.getExtensionInstruction(
                    ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type());

    try {
        extensionInstruction.setPropertyValue(TUNNEL_DESTINATION, hostIp);
    } catch (ExtensionPropertyException e) {
        log.error("Error setting Nicira extension setting {}", e);
    }

    return extensionInstruction;
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:25,
代码来源:SelectGroupHandler.java

示例13: tunnelDstTreatment

点赞 3

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
private ExtensionTreatment tunnelDstTreatment(DeviceId deviceId, IpAddress remoteIp) {
    Device device = deviceService.getDevice(deviceId);
    if (device != null && !device.is(ExtensionTreatmentResolver.class)) {
        log.error("The extension treatment is not supported");
        return null;
    }

    if (device == null) {
        return null;
    }

    ExtensionTreatmentResolver resolver = device.as(ExtensionTreatmentResolver.class);
    ExtensionTreatment treatment = resolver.getExtensionInstruction(NICIRA_SET_TUNNEL_DST.type());
    try {
        treatment.setPropertyValue("tunnelDst", remoteIp.getIp4Address());
        return treatment;
    } catch (ExtensionPropertyException e) {
        log.warn("Failed to get tunnelDst extension treatment for {}", deviceId);
        return null;
    }
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:22,
代码来源:DefaultOpenstackNodeHandler.java

示例14: decodeExtension

点赞 3

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
/**
 * Decodes a extension instruction.
 *
 * @return extension treatment
 */
private Instruction decodeExtension() {
    ObjectNode node = (ObjectNode) json.get(InstructionCodec.EXTENSION);
    if (node != null) {
        DeviceId deviceId = getDeviceId();

        ServiceDirectory serviceDirectory = new DefaultServiceDirectory();
        DeviceService deviceService = serviceDirectory.get(DeviceService.class);
        Device device = deviceService.getDevice(deviceId);

        if (device == null) {
            throw new IllegalArgumentException("Device not found");
        }

        if (device.is(ExtensionTreatmentCodec.class)) {
            ExtensionTreatmentCodec treatmentCodec = device.as(ExtensionTreatmentCodec.class);
            ExtensionTreatment treatment = treatmentCodec.decode(node, context);
            return Instructions.extension(treatment, deviceId);
        } else {
            throw new IllegalArgumentException(
                    "There is no codec to decode extension for device " + deviceId.toString());
        }
    }
    return null;
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:30,
代码来源:DecodeInstructionCodecHelper.java

示例15: read

点赞 3

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
@Override
public Instructions.ExtensionInstructionWrapper read(Kryo kryo, Input input,
                                                     Class<Instructions.ExtensionInstructionWrapper> type) {
    ExtensionTreatmentType exType = (ExtensionTreatmentType) kryo.readClassAndObject(input);
    DeviceId deviceId = (DeviceId) kryo.readClassAndObject(input);
    DriverService driverService = DefaultServiceDirectory.getService(DriverService.class);
    byte[] bytes = (byte[]) kryo.readClassAndObject(input);
    ExtensionTreatment instruction;

    try {
        DriverHandler handler = new DefaultDriverHandler(
                new DefaultDriverData(driverService.getDriver(deviceId), deviceId));
        ExtensionTreatmentResolver resolver = handler.behaviour(ExtensionTreatmentResolver.class);
        instruction = resolver.getExtensionInstruction(exType);
        instruction.deserialize(bytes);
    } catch (ItemNotFoundException | IllegalArgumentException e) {
        instruction = new UnresolvedExtensionTreatment(bytes, exType);
    }

    return Instructions.extension(instruction, deviceId);
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:22,
代码来源:ExtensionInstructionSerializer.java

示例16: mapInstruction

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
@Override
public OFAction mapInstruction(OFFactory factory, ExtensionTreatment extensionTreatment) {
    ExtensionTreatmentType type = extensionTreatment.type();
    if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_VLAN_ID.type())) {
        VlanId vlanId = ((OfdpaSetVlanVid) extensionTreatment).vlanId();
        // NOTE: OFDPA requires isPresent bit set to zero.
        OFVlanVidMatch match = OFVlanVidMatch.ofRawVid(vlanId.toShort());
        return factory.actions().setField(factory.oxms().vlanVid(match));
    }
    throw new UnsupportedOperationException(
            "Unexpected ExtensionTreatment: " + extensionTreatment.toString());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:13,
代码来源:OfdpaExtensionTreatmentInterpreter.java

示例17: getExtensionInstruction

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
@Override
public ExtensionTreatment getExtensionInstruction(ExtensionTreatmentType type) {
    if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_VLAN_ID.type())) {
        return new OfdpaSetVlanVid();
    }
    throw new UnsupportedOperationException(
            "Driver does not support extension type " + type.toString());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:9,
代码来源:OfdpaExtensionTreatmentInterpreter.java

示例18: createNiciraMovArpShaToTha

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
/**
 * Creates a move treatment that move arp sha to tha.
 *
 * @return ExtensionTreatment
 */
public static ExtensionTreatment createNiciraMovArpShaToTha() {
    int srcOfs = 0;
    int dstOfs = 0;
    int nBits = 48;
    int srcSha = 0x00012206;
    int dstTha = 0x00012406;
    return new DefaultMoveExtensionTreatment(srcOfs, dstOfs, nBits, srcSha,
                                             dstTha,
                                             ExtensionTreatmentType.ExtensionTreatmentTypes
                                             .NICIRA_MOV_ARP_SHA_TO_THA.type());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:17,
代码来源:NiciraMoveTreatmentFactory.java

示例19: createNiciraMovArpSpaToTpa

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
/**
 * Creates a move treatment that move arp spa to tpa.
 *
 * @return ExtensionTreatment
 */
public static ExtensionTreatment createNiciraMovArpSpaToTpa() {
    int srcOfs = 0;
    int dstOfs = 0;
    int nBits = 32;
    int srcSpa = 0x00002004;
    int dstTpa = 0x00002204;
    return new DefaultMoveExtensionTreatment(srcOfs, dstOfs, nBits, srcSpa,
                                             dstTpa,
                                             ExtensionTreatmentType.ExtensionTreatmentTypes
                                             .NICIRA_MOV_ARP_SPA_TO_TPA.type());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:17,
代码来源:NiciraMoveTreatmentFactory.java

示例20: createNiciraMovEthSrcToDst

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
/**
 * Creates a move treatment that move eth src to dst.
 *
 * @return ExtensionTreatment
 */
public static ExtensionTreatment createNiciraMovEthSrcToDst() {
    int srcOfs = 0;
    int dstOfs = 0;
    int nBits = 48;
    int srcEth = 0x00000406;
    int dstEth = 0x00000206;
    return new DefaultMoveExtensionTreatment(srcOfs, dstOfs, nBits, srcEth,
                                             dstEth,
                                             ExtensionTreatmentType.ExtensionTreatmentTypes
                                             .NICIRA_MOV_ETH_SRC_TO_DST.type());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:17,
代码来源:NiciraMoveTreatmentFactory.java

示例21: createNiciraMovIpSrcToDst

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
/**
 * Creates a move treatment that move ip src to dst.
 *
 * @return ExtensionTreatment
 */
public static ExtensionTreatment createNiciraMovIpSrcToDst() {
    int srcOfs = 0;
    int dstOfs = 0;
    int nBits = 32;
    int srcIp = 0x00000e04;
    int dstIp = 0x00001004;
    return new DefaultMoveExtensionTreatment(srcOfs, dstOfs, nBits, srcIp,
                                             dstIp,
                                             ExtensionTreatmentType.ExtensionTreatmentTypes
                                             .NICIRA_MOV_IP_SRC_TO_DST.type());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:17,
代码来源:NiciraMoveTreatmentFactory.java

示例22: createNiciraMovNshC1ToC1

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
public static ExtensionTreatment createNiciraMovNshC1ToC1() {
    int srcOfs = 0;
    int dstOfs = 0;
    int nBits = 32;
    int srcC1 = 0x0001e604;
    int dstC1 = 0x0001e604;
    return new DefaultMoveExtensionTreatment(srcOfs, dstOfs, nBits, srcC1,
                                             dstC1,
                                             ExtensionTreatmentType.ExtensionTreatmentTypes
                                             .NICIRA_MOV_NSH_C1_TO_C1.type());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:12,
代码来源:NiciraMoveTreatmentFactory.java

示例23: createNiciraMovNshC2ToC2

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
public static ExtensionTreatment createNiciraMovNshC2ToC2() {
    int srcOfs = 0;
    int dstOfs = 0;
    int nBits = 32;
    int srcC2 = 0x0001e804;
    int dstC2 = 0x0001e804;
    return new DefaultMoveExtensionTreatment(srcOfs, dstOfs, nBits, srcC2,
                                             dstC2,
                                             ExtensionTreatmentType.ExtensionTreatmentTypes
                                             .NICIRA_MOV_NSH_C2_TO_C2.type());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:12,
代码来源:NiciraMoveTreatmentFactory.java

示例24: createNiciraMovNshC3ToC3

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
public static ExtensionTreatment createNiciraMovNshC3ToC3() {
    int srcOfs = 0;
    int dstOfs = 0;
    int nBits = 32;
    int srcC3 = 0x0001ea04;
    int dstC3 = 0x0001ea04;
    return new DefaultMoveExtensionTreatment(srcOfs, dstOfs, nBits, srcC3,
                                             dstC3,
                                             ExtensionTreatmentType.ExtensionTreatmentTypes
                                             .NICIRA_MOV_NSH_C3_TO_C3.type());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:12,
代码来源:NiciraMoveTreatmentFactory.java

示例25: createNiciraMovNshC4ToC4

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
public static ExtensionTreatment createNiciraMovNshC4ToC4() {
    int srcOfs = 0;
    int dstOfs = 0;
    int nBits = 32;
    int srcC4 = 0x0001ec04;
    int dstC4 = 0x0001ec04;
    return new DefaultMoveExtensionTreatment(srcOfs, dstOfs, nBits, srcC4,
                                             dstC4,
                                             ExtensionTreatmentType.ExtensionTreatmentTypes
                                             .NICIRA_MOV_NSH_C4_TO_C4.type());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:12,
代码来源:NiciraMoveTreatmentFactory.java

示例26: createNiciraMovTunDstToTunDst

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
public static ExtensionTreatment createNiciraMovTunDstToTunDst() {
    int srcOfs = 0;
    int dstOfs = 0;
    int nBits = 32;
    int srcTunIpv4Dst = 0x00014004;
    int dstTunIpv4Dst = 0x00014004;
    return new DefaultMoveExtensionTreatment(srcOfs, dstOfs, nBits, srcTunIpv4Dst,
                                             dstTunIpv4Dst,
                                             ExtensionTreatmentType.ExtensionTreatmentTypes
                                             .NICIRA_MOV_TUN_IPV4_DST_TO_TUN_IPV4_DST.type());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:12,
代码来源:NiciraMoveTreatmentFactory.java

示例27: createNiciraMovTunIdToTunId

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
public static ExtensionTreatment createNiciraMovTunIdToTunId() {
    int srcOfs = 0;
    int dstOfs = 0;
    int nBits = 64;
    int srcTunId = 0x12008;
    int dstTunId = 0x12008; // 0x80004c08;
    return new DefaultMoveExtensionTreatment(srcOfs, dstOfs, nBits, srcTunId,
                                             dstTunId,
                                             ExtensionTreatmentType.ExtensionTreatmentTypes
                                             .NICIRA_MOV_TUN_ID_TO_TUN_ID.type());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:12,
代码来源:NiciraMoveTreatmentFactory.java

示例28: createNiciraMovNshC2ToTunId

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
public static ExtensionTreatment createNiciraMovNshC2ToTunId() {
    int srcOfs = 0;
    int dstOfs = 0;
    int nBits = 32;
    int srcC2 = 0x0001e804;
    int dstTunId = 0x80004c08;
    return new DefaultMoveExtensionTreatment(srcOfs, dstOfs, nBits, srcC2,
                                             dstTunId,
                                             ExtensionTreatmentType.ExtensionTreatmentTypes
                                             .NICIRA_MOV_NSH_C2_TO_TUN_ID.type());
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:12,
代码来源:NiciraMoveTreatmentFactory.java

示例29: getExtensionInstruction

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
@Override
public ExtensionTreatment getExtensionInstruction(ExtensionTreatmentType type) {
    if (type.equals(BMV2_ACTION.type())) {
        return Bmv2ExtensionTreatment.empty();
    }
    return null;
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:8,
代码来源:Bmv2ExtensionTreatmentResolver.java

示例30: getActionFromExtension

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
private Bmv2Action getActionFromExtension(Instructions.ExtensionInstructionWrapper inst)
        throws Bmv2FlowRuleTranslatorException {

    ExtensionTreatment extTreatment = inst.extensionInstruction();

    if (extTreatment.type() == ExtensionTreatmentTypes.BMV2_ACTION.type()) {
        if (extTreatment instanceof Bmv2ExtensionTreatment) {
            return ((Bmv2ExtensionTreatment) extTreatment).action();
        } else {
            throw new Bmv2FlowRuleTranslatorException("Unable to decode treatment extension: " + extTreatment);
        }
    } else {
        throw new Bmv2FlowRuleTranslatorException("Unsupported treatment extension type: " + extTreatment.type());
    }
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:16,
代码来源:Bmv2FlowRuleTranslatorImpl.java

示例31: buildExtensionAction

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
private OFAction buildExtensionAction(ExtensionTreatment i) {
    if (!driverService.isPresent()) {
        log.error("No driver service present");
        return null;
    }
    Driver driver = driverService.get().getDriver(deviceId);
    if (driver.hasBehaviour(ExtensionTreatmentInterpreter.class)) {
        DefaultDriverHandler handler =
                new DefaultDriverHandler(new DefaultDriverData(driver, deviceId));
        ExtensionTreatmentInterpreter interpreter = handler.behaviour(ExtensionTreatmentInterpreter.class);
        return interpreter.mapInstruction(factory(), i);
    }

    return null;
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:16,
代码来源:FlowModBuilderVer13.java

示例32: buildExtensionAction

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
private OFAction buildExtensionAction(ExtensionTreatment i, DeviceId deviceId) {
    if (!driverService.isPresent()) {
        log.error("No driver service present");
        return null;
    }
    Driver driver = driverService.get().getDriver(deviceId);
    if (driver.hasBehaviour(ExtensionTreatmentInterpreter.class)) {
        DefaultDriverHandler handler =
                new DefaultDriverHandler(new DefaultDriverData(driver, deviceId));
        ExtensionTreatmentInterpreter interpreter = handler.behaviour(ExtensionTreatmentInterpreter.class);
        return interpreter.mapInstruction(factory, i);
    }

    return null;
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:16,
代码来源:GroupModBuilder.java

示例33: provisionWcmpTreatment

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
private Pair<ExtensionTreatment, List<FlowRule>> provisionWcmpTreatment(DeviceId deviceId,
                                                                        Map<PortNumber, Double> weightedFabricPorts)
        throws FlowRuleGeneratorException {

    // Install WCMP group table entries that map from hash values to fabric ports.

    int groupId = groupIdOf(deviceId, weightedFabricPorts);
    List<PortNumber> portNumbers = Lists.newArrayList();
    List<Double> weights = Lists.newArrayList();
    weightedFabricPorts.forEach((p, w) -> {
        portNumbers.add(p);
        weights.add(w);
    });
    List<Integer> prefixLengths = toPrefixLengths(weights);

    List<FlowRule> rules = Lists.newArrayList();
    for (int i = 0; i < portNumbers.size(); i++) {
        ExtensionSelector extSelector = buildWcmpSelector(groupId, prefixLengths.get(i));
        FlowRule rule = flowRuleBuilder(deviceId, WCMP_GROUP_TABLE)
                .withSelector(DefaultTrafficSelector.builder()
                                      .extension(extSelector, deviceId)
                                      .build())
                .withTreatment(
                        DefaultTrafficTreatment.builder()
                                .setOutput(portNumbers.get(i))
                                .build())
                .build();
        rules.add(rule);
    }

    ExtensionTreatment extTreatment = buildWcmpTreatment(groupId);

    return Pair.of(extTreatment, rules);
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:35,
代码来源:WcmpFabricApp.java

示例34: provisionEcmpTreatment

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
private Pair<ExtensionTreatment, List<FlowRule>> provisionEcmpTreatment(DeviceId deviceId,
                                                                        Set<PortNumber> fabricPorts)
        throws FlowRuleGeneratorException {

    // Install ECMP group table entries that map from hash values to actual fabric ports...
    int groupId = groupIdOf(deviceId, fabricPorts);
    int groupSize = fabricPorts.size();
    Iterator<PortNumber> portIterator = fabricPorts.iterator();
    List<FlowRule> rules = Lists.newArrayList();
    for (short i = 0; i < groupSize; i++) {
        ExtensionSelector extSelector = buildEcmpSelector(groupId, i);
        FlowRule rule = flowRuleBuilder(deviceId, ECMP_GROUP_TABLE)
                .withSelector(
                        DefaultTrafficSelector.builder()
                                .extension(extSelector, deviceId)
                                .build())
                .withTreatment(
                        DefaultTrafficTreatment.builder()
                                .setOutput(portIterator.next())
                                .build())
                .build();
        rules.add(rule);
    }

    ExtensionTreatment extTreatment = buildEcmpTreatment(groupId, groupSize);

    return Pair.of(extTreatment, rules);
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:29,
代码来源:EcmpFabricApp.java

示例35: encode

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
@Override
public ObjectNode encode(ExtensionTreatment extensionTreatment, CodecContext context) {
    checkNotNull(extensionTreatment, MISSING_TREATMENT_MESSAGE);
    ExtensionTreatmentType type = extensionTreatment.type();
    ObjectNode root = context.mapper().createObjectNode();

    if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_MPLS_TYPE.type())) {
        Ofdpa3SetMplsType setMplsType = (Ofdpa3SetMplsType) extensionTreatment;
        root.put(TYPE, ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_MPLS_TYPE.name());
        root.setAll(context.codec(Ofdpa3SetMplsType.class).encode(setMplsType, context));
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_OVID.type())) {
        Ofdpa3SetOvid setOvid = (Ofdpa3SetOvid) extensionTreatment;
        root.put(TYPE, ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_OVID.name());
        root.setAll(context.codec(Ofdpa3SetOvid.class).encode(setOvid, context));
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_MPLS_L2_PORT.type())) {
        Ofdpa3SetMplsL2Port setMplsL2Port = (Ofdpa3SetMplsL2Port) extensionTreatment;
        root.put(TYPE, ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_MPLS_L2_PORT.name());
        root.setAll(context.codec(Ofdpa3SetMplsL2Port.class).encode(setMplsL2Port, context));
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_QOS_INDEX.type())) {
        Ofdpa3SetQosIndex setQosIndex = (Ofdpa3SetQosIndex) extensionTreatment;
        root.put(TYPE, ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_QOS_INDEX.name());
        root.setAll(context.codec(Ofdpa3SetQosIndex.class).encode(setQosIndex, context));
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_PUSH_L2_HEADER.type())) {
        root.put(TYPE, ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_PUSH_L2_HEADER.name());
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_PUSH_CW.type())) {
        root.put(TYPE, ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_PUSH_CW.name());
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_POP_L2_HEADER.type())) {
        root.put(TYPE, ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_POP_L2_HEADER.name());
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_POP_CW.type())) {
        root.put(TYPE, ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_POP_CW.name());
    }

    return root;
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:35,
代码来源:Ofdpa3ExtensionTreatmentInterpreter.java

示例36: decode

点赞 2

import org.onosproject.net.flow.instructions.ExtensionTreatment; //导入依赖的package包/类
@Override
public ExtensionTreatment decode(ObjectNode json, CodecContext context) {
    if (json == null || !json.isObject()) {
        return null;
    }

    String type = nullIsIllegal(json.get(TYPE), TYPE + MISSING_MEMBER_MESSAGE).asText();

    if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_MPLS_TYPE.name())) {
        return context.codec(Ofdpa3SetMplsType.class).decode(json, context);
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_OVID.name())) {
        return context.codec(Ofdpa3SetOvid.class).decode(json, context);
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_MPLS_L2_PORT.name())) {
        return context.codec(Ofdpa3SetMplsL2Port.class).decode(json, context);
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_QOS_INDEX.name())) {
        return context.codec(Ofdpa3SetQosIndex.class).decode(json, context);
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_PUSH_L2_HEADER.name())) {
        return new Ofdpa3PushL2Header();
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_PUSH_CW.name())) {
        return new Ofdpa3PushCw();
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_POP_L2_HEADER.name())) {
        return new Ofdpa3PopL2Header();
    } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_POP_CW.name())) {
        return new Ofdpa3PopCw();
    } else {
        throw new UnsupportedOperationException(NOT_SUPPORTED_MESSAGE + type.toString());
    }
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:29,
代码来源:Ofdpa3ExtensionTreatmentInterpreter.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)